Skip to content

Commit

Permalink
chore(services/importer): import set lot for strong app
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnisDa committed Dec 8, 2024
1 parent ed28bb0 commit ecf7e5c
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions crates/services/importer/src/strong_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ecf7e5c

Please sign in to comment.