Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
ekr-cfa committed Nov 27, 2024
1 parent 22e2938 commit 061d2c1
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions src/people.rs
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ impl ContextPeopleExt for Context {
fn query_people_count<T: Query>(&self, q: T) -> usize {
// Special case the situation where nobody exists.
if self.get_data_container(PeoplePlugin).is_none() {
return 0
return 0;
}

T::setup(self);
Expand Down Expand Up @@ -948,8 +948,11 @@ trait ContextPeopleExtInternal {
person_id: PersonId,
property: T,
);
fn query_people_internal<T: PeopleAccumulator> (&self, accumulator: &mut T,
property_hashes: Vec<(TypeId, IndexValue)>);
fn query_people_internal<T: PeopleAccumulator>(
&self,
accumulator: &mut T,
property_hashes: Vec<(TypeId, IndexValue)>,
);
}

impl ContextPeopleExtInternal for Context {
Expand Down Expand Up @@ -1002,7 +1005,11 @@ impl ContextPeopleExtInternal for Context {
}
}

fn query_people_internal<T: PeopleAccumulator>(&self, accumulator: &mut T, property_hashes: Vec<(TypeId, IndexValue)>) {
fn query_people_internal<T: PeopleAccumulator>(
&self,
accumulator: &mut T,
property_hashes: Vec<(TypeId, IndexValue)>,
) {
let mut indexes = Vec::<Ref<HashSet<PersonId>>>::new();
let mut unindexed = Vec::<(TypeId, IndexValue)>::new();
let data_container = self.get_data_container(PeoplePlugin)
Expand Down Expand Up @@ -1510,16 +1517,22 @@ mod test {
.add_person((RiskCategoryType, RiskCategory::High))
.unwrap();

assert_eq!(context.query_people_count((RiskCategoryType, RiskCategory::High)), 1);
assert_eq!(
context.query_people_count((RiskCategoryType, RiskCategory::High)),
1
);
}

#[test]
fn query_people_count_empty() {
let context = Context::new();

assert_eq!(context.query_people_count((RiskCategoryType, RiskCategory::High)), 0);
assert_eq!(
context.query_people_count((RiskCategoryType, RiskCategory::High)),
0
);
}

#[test]
fn query_people_macro_index_first() {
let mut context = Context::new();
Expand Down

0 comments on commit 061d2c1

Please sign in to comment.