From ecf7e5ccc0a9c88d88efa1a6555ff79d18f8d268 Mon Sep 17 00:00:00 2001 From: Diptesh Choudhuri Date: Sun, 8 Dec 2024 16:22:05 +0530 Subject: [PATCH] chore(services/importer): import set lot for strong app --- crates/services/importer/src/strong_app.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/crates/services/importer/src/strong_app.rs b/crates/services/importer/src/strong_app.rs index eecfbf42f8..86519f43d9 100644 --- a/crates/services/importer/src/strong_app.rs +++ b/crates/services/importer/src/strong_app.rs @@ -173,23 +173,29 @@ async fn import_exercises( }, }; ryot_log!(debug, "Importing exercise with id = {}", exercise_id); - for sets in exercises { - if let Some(note) = sets.notes { + for set in exercises { + if let Some(note) = set.notes { notes.push(note); } - let weight = sets.weight.map(|d| if d == dec!(0) { dec!(1) } else { d }); + let weight = set.weight.map(|d| if d == dec!(0) { dec!(1) } else { d }); + let set_lot = match set.set_order.as_str() { + "W" => SetLot::WarmUp, + "F" => SetLot::Failure, + "D" => SetLot::Drop, + _ => SetLot::Normal, + }; collected_sets.push(UserWorkoutSetRecord { statistic: WorkoutSetStatistic { weight, - reps: sets.reps, - duration: sets.seconds.and_then(|r| r.checked_div(dec!(60))), - distance: sets.distance.and_then(|d| d.checked_div(dec!(1000))), + reps: set.reps, + duration: set.seconds.and_then(|r| r.checked_div(dec!(60))), + distance: set.distance.and_then(|d| d.checked_div(dec!(1000))), ..Default::default() }, note: None, + lot: set_lot, rest_time: None, confirmed_at: None, - lot: SetLot::Normal, }); } collected_exercises.push(UserExerciseInput {