Thoroughly fill out the day detail view model along with proper automated testing #179
|
@ -110,6 +110,14 @@ impl DayDetailViewModel {
|
||||||
.partition(|r| r.data.is_weight());
|
.partition(|r| r.data.is_weight());
|
||||||
let (step_records, records): (Vec<Record<TraxRecord>>, Vec<Record<TraxRecord>>) =
|
let (step_records, records): (Vec<Record<TraxRecord>>, Vec<Record<TraxRecord>>) =
|
||||||
records.into_iter().partition(|r| r.data.is_steps());
|
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 {
|
Ok(Self {
|
||||||
provider: Arc::new(provider),
|
provider: Arc::new(provider),
|
||||||
date,
|
date,
|
||||||
|
@ -454,20 +462,6 @@ mod test {
|
||||||
count: 2500,
|
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 {
|
Record {
|
||||||
id: RecordId::default(),
|
id: RecordId::default(),
|
||||||
data: TraxRecord::BikeRide(ft_core::TimeDistance {
|
data: TraxRecord::BikeRide(ft_core::TimeDistance {
|
||||||
|
|
Loading…
Reference in New Issue