Skip to content

Commit

Permalink
Fix build (#38)
Browse files Browse the repository at this point in the history
Co-authored-by: EKR <[email protected]>
  • Loading branch information
ekr-cfa and ekr authored Jan 8, 2025
1 parent 3e1f156 commit af5569c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/transmission_modifiers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,20 @@ impl ContextTransmissionModifierExt for Context {
person_property: T,
instance_dict: Vec<(T::Value, f64)>,
) {
let mut instance_map = HashMap::new();
let mut instance_map = HashMap::<TypeId, Box<InterventionFn>>::new();
instance_map.insert(
TypeId::of::<T>(),
move |context: &mut Context, person_id| -> f64 {
Box::new(move |context: &Context, person_id| -> f64 {
let property_val = context.get_person_property(person_id, person_property);

for item in instance_dict {
for item in &instance_dict {
if property_val == item.0 {
return item.1;
}
}
// Return a default 1.0 (no relative change if unregistered)
return 1.0;
},
}),
);

let intervention_container = self.get_data_container_mut(InterventionPlugin);
Expand Down Expand Up @@ -116,6 +116,10 @@ impl ContextTransmissionModifierExt for Context {
}
}

pub fn query_modifers(context: &mut Context, transmitter_id: PersonId, contact_id: PersonId) -> f64 {
pub fn query_modifers(
context: &mut Context,
transmitter_id: PersonId,
contact_id: PersonId,
) -> f64 {
context.compute_intervention(transmitter_id) * context.compute_intervention(contact_id)
}

0 comments on commit af5569c

Please sign in to comment.