Skip to content

Commit

Permalink
include location, name, emal, program on search
Browse files Browse the repository at this point in the history
  • Loading branch information
SeaDve committed Dec 9, 2024
1 parent ed05acc commit c7f69bb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/entity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl Entity {
}

pub fn stock_id(&self) -> Option<StockId> {
self.data().stock_id().cloned()
self.imp().data.borrow().stock_id().cloned()
}

pub fn is_inside_for_dt(&self, dt: DateTime<Utc>) -> bool {
Expand Down
6 changes: 4 additions & 2 deletions src/entity_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ entity_data_field! {
StockId(StockId) => "Stock Name",
Location(String) => "Location",
ExpirationDt(DateTime<Utc>) => "Expiration Date",

Photo(JpegImage) => "Photo",

Name(String) => "Name",
Sex(Sex) => "Sex",
Email(String) => "Email",
Expand Down Expand Up @@ -106,9 +104,13 @@ impl EntityData {
}

entity_data_getter!(stock_id, StockId, &StockId);
entity_data_getter!(location, Location, &String);
entity_data_getter!(expiration_dt, ExpirationDt, &DateTime<Utc>);
entity_data_getter!(photo, Photo, &JpegImage);
entity_data_getter!(name, Name, &String);
entity_data_getter!(sex, Sex, &Sex);
entity_data_getter!(email, Email, &String);
entity_data_getter!(program, Program, &String);
}

impl Serialize for EntityData {
Expand Down
6 changes: 5 additions & 1 deletion src/ui/entities_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,14 @@ mod imp {

let fuzzy_filter = FuzzyFilter::new(|o| {
let entity = o.downcast_ref::<Entity>().unwrap();
let entity_data = entity.data();
[
Some(entity.id().to_string()),
entity.stock_id().map(|s| s.to_string()),
entity.data().name().cloned(),
entity_data.location().cloned(),
entity_data.name().cloned(),
entity_data.email().cloned(),
entity_data.program().cloned(),
]
.into_iter()
.flatten()
Expand Down

0 comments on commit c7f69bb

Please sign in to comment.