This commit is contained in:
chaos 2024-11-27 22:46:02 +00:00
parent f711240faa
commit 2de88b9beb

View file

@ -27,9 +27,7 @@ pub fn calculate_sustenance_ingestion_amounts(sustenance: &mut SustenanceIngesti
calculate_sustenance_ingestion_amounts(ingestion)
}
IngestionKind::Hydration(hydration) => {
hydration.amount_ml *= sustenance.amount
}
IngestionKind::Hydration(hydration) => hydration.amount_ml *= sustenance.amount,
_ => {}
}
}
@ -47,18 +45,17 @@ pub fn calculate_sustenance_contents(root: SustenanceIngestion) -> CalculatedVal
match ingestion {
IngestionKind::Unknown => {}
IngestionKind::Substance(substance) => {
let substance_ingestion = values
.substances
.get(&substance.id)
.cloned()
.unwrap_or(SubstanceIngestion {
id: substance.id.clone(),
substance: None,
dose: Dose::new_precise(0.0),
custom_unit_id: None,
roa: AdministrationRoute::Oral,
stomach_fullness: None,
});
let substance_ingestion =
values.substances.get(&substance.id).cloned().unwrap_or(
SubstanceIngestion {
id: substance.id.clone(),
substance: None,
dose: Dose::new_precise(0.0),
custom_unit_id: None,
roa: AdministrationRoute::Oral,
stomach_fullness: None,
},
);
values.substances.insert(
substance.id.clone(),
@ -85,7 +82,7 @@ pub fn calculate_sustenance_contents(root: SustenanceIngestion) -> CalculatedVal
}
}
IngestionKind::Hydration(hydration) => {
values.hydration.amount_ml += hydration.amount_ml;
values.hydration.amount_ml *= hydration.amount_ml;
}
}
}