diff --git a/journal/src/calculate.rs b/journal/src/calculate.rs index 9fbff83..d7c0d5a 100644 --- a/journal/src/calculate.rs +++ b/journal/src/calculate.rs @@ -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; } } }