Skip to content

Commit

Permalink
chore(utils/dependent): schedule user for workout revision if workout…
Browse files Browse the repository at this point in the history
…s were imported
  • Loading branch information
IgnisDa committed Dec 11, 2024
1 parent b3fdf32 commit 260b264
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crates/utils/dependent/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2116,6 +2116,8 @@ where
let source_result = import.clone();
let total = import.completed.len();

let mut need_to_schedule_user_for_workout_revision = false;

for (idx, item) in import.completed.into_iter().enumerate() {
ryot_log!(
debug,
Expand Down Expand Up @@ -2315,6 +2317,7 @@ where
}
}
ImportCompletedItem::Workout(workout) => {
need_to_schedule_user_for_workout_revision = true;
if let Err(err) = create_or_update_workout(workout, user_id, ss).await {
import.failed.push(ImportFailedItem {
lot: None,
Expand Down Expand Up @@ -2366,6 +2369,10 @@ where
.await?;
}

if need_to_schedule_user_for_workout_revision {
schedule_user_for_workout_revision(user_id, ss).await?;
}

let details = ImportResultResponse {
failed_items: import.failed,
import: ImportDetails { total },
Expand Down

0 comments on commit 260b264

Please sign in to comment.