diff --git a/rslib/src/scheduler/states/steps.rs b/rslib/src/scheduler/states/steps.rs index 1c12ce621fd..82394f6516d 100644 --- a/rslib/src/scheduler/states/steps.rs +++ b/rslib/src/scheduler/states/steps.rs @@ -53,11 +53,11 @@ impl<'a> LearningSteps<'a> { let next = if self.steps.len() > 1 { self.secs_at_index(idx + 1).unwrap_or(60) } else { - current * 2 + current.saturating_mul(2) } .max(current); - Some((current + next) / 2) + Some(current.saturating_add(next) / 2) } else { None } diff --git a/ts/deck-options/steps.ts b/ts/deck-options/steps.ts index 3fd17f110d9..2a2916cf043 100644 --- a/ts/deck-options/steps.ts +++ b/ts/deck-options/steps.ts @@ -49,7 +49,9 @@ function stringToMinutes(text: string): number { const [_, num, suffix] = match; const unit = suffixToUnit(suffix); const seconds = unitSeconds(unit) * parseInt(num, 10); - return seconds / 60; + // should be representable as u32 seconds on the backend + const capped_seconds = Math.min(seconds, 2 ** 32 - 1); + return capped_seconds / 60; } else { return 0; }