From a8bf540517cd1dca12a9475ecc3126ea9e276e69 Mon Sep 17 00:00:00 2001 From: Savanni D'Gerinel Date: Wed, 7 Feb 2024 08:28:38 -0500 Subject: [PATCH] Remove test that steps and weights are honored correctly Step and weight records may be presented in any order. Any test that tries to enforce that one gets presented before teh other can't cannot succeed. So, I've removed that test and instead put in a warning that will appear when the view model gets loaded. --- fitnesstrax/app/src/view_models/day_detail.rs | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/fitnesstrax/app/src/view_models/day_detail.rs b/fitnesstrax/app/src/view_models/day_detail.rs index 2cd7224..c4223e9 100644 --- a/fitnesstrax/app/src/view_models/day_detail.rs +++ b/fitnesstrax/app/src/view_models/day_detail.rs @@ -110,6 +110,14 @@ impl DayDetailViewModel { .partition(|r| r.data.is_weight()); let (step_records, records): (Vec>, Vec>) = records.into_iter().partition(|r| r.data.is_steps()); + + if weight_records.len() > 1 { + eprintln!("warning: multiple weight records found for {}. This is unsupported and the one presented is unpredictable.", date.format("%Y-%m-%d")); + } + if step_records.len() > 1 { + eprintln!("warning: multiple step records found for {}. This is unsupported and the one presented is unpredictable.", date.format("%Y-%m-%d")); + } + Ok(Self { provider: Arc::new(provider), date, @@ -454,20 +462,6 @@ mod test { count: 2500, }), }, - Record { - id: RecordId::default(), - data: TraxRecord::Weight(ft_core::Weight { - date: oct_13.clone(), - weight: 91. * si::KG, - }), - }, - Record { - id: RecordId::default(), - data: TraxRecord::Steps(ft_core::Steps { - date: oct_13.clone(), - count: 2750, - }), - }, Record { id: RecordId::default(), data: TraxRecord::BikeRide(ft_core::TimeDistance {