Add the ability to edit the time of a workout and the associated activity. #183

Merged
savanni merged 5 commits from fitnesstrax/edit-time-and-activity into main 2024-02-09 13:31:40 +00:00
1 changed files with 12 additions and 1 deletions
Showing only changes of commit 6394d89331 - Show all commits

View File

@ -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,