Add the ability to edit the time of a workout and the associated activity. #183
|
@ -176,9 +176,20 @@ impl DayDetailViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_time_distance(&self, activity: TimeDistanceActivity) -> Record<TimeDistance> {
|
pub fn new_time_distance(&self, activity: TimeDistanceActivity) -> Record<TimeDistance> {
|
||||||
|
let now = chrono::Local::now();
|
||||||
|
let base_time = now.time();
|
||||||
|
let tz = now.timezone();
|
||||||
|
let datetime = self
|
||||||
|
.date
|
||||||
|
.clone()
|
||||||
|
.and_time(base_time)
|
||||||
|
.and_local_timezone(tz)
|
||||||
|
.unwrap()
|
||||||
|
.into();
|
||||||
|
|
||||||
let id = RecordId::default();
|
let id = RecordId::default();
|
||||||
let workout = TimeDistance {
|
let workout = TimeDistance {
|
||||||
datetime: chrono::Local::now().into(),
|
datetime,
|
||||||
activity,
|
activity,
|
||||||
distance: None,
|
distance: None,
|
||||||
duration: None,
|
duration: None,
|
||||||
|
|
Loading…
Reference in New Issue