You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the New cards/day section set all Preset, This deck and Today only to zero
Click Save
Again, go to Deck options, click on the Preset and change it to any value
Click Save -> panic at rslib\src\deckconfig\update.rs:419:39: attempt to subtract with overflow
I modified the rslib\src\deckconfig\update.rs:update_deck_limits/update_day_limit in the following way:
fnupdate_deck_limits(deck:&mutNormalDeck,limits:&Limits,today:u32){println!("limits={limits:?}");
deck.review_limit = limits.review;
deck.new_limit = limits.new;update_day_limit(&mut deck.review_limit_today, limits.review_today, today);update_day_limit(&mut deck.new_limit_today, limits.new_today, today);}fnupdate_day_limit(day_limit:&mutOption<DayLimit>,new_limit:Option<u32>,today:u32){println!("day_limit={day_limit:?}\tnew_limit={new_limit:?}\ttoday={today:?}");ifletSome(limit) = new_limit {
day_limit.replace(DayLimit{ limit, today });}elseifletSome(limit) = day_limit {// instead of setting to None, only make sure today is in the past,// thus preserving last used value
limit.today = limit.today.min(today - 1);}}
After doing that we get the following traceback (and debug prints):
rslib\src\deckconfig\update.rs:update_day_limit: limit.today = limit.today.min(today - 1); <- no protection from overflow
ts/routes/deck-options/DailyLimits.svelte: newTabs array on the line 72
ts/routes/deck-options/lib.ts
The problem seems not even be the overflow itself but the fact that new_today is None in the Limits object (and not Some(0) as on the first save).
If you fix the overflow by doing something like limit.today = limit.today.min(today.max(1) - 1);, you are now stuck: you can not change the New cards/day to Preset, you are stuck on the Today only.
On the 24.06.3 there is the same issue (without panic - only the Today only hardlock/softlock):
demo (on main):
Demo.mp4
Steps to reproduce:
New cards/daysection set allPreset,This deckandToday onlyto zeroSavePresetand change it to any valueSave->panic at rslib\src\deckconfig\update.rs:419:39: attempt to subtract with overflowI modified the
rslib\src\deckconfig\update.rs:update_deck_limits/update_day_limitin the following way:After doing that we get the following traceback (and debug prints):
Most obvious candidates on bugs are:
rslib\src\deckconfig\update.rs:update_day_limit:limit.today = limit.today.min(today - 1);<- no protection from overflowts/routes/deck-options/DailyLimits.svelte: newTabs array on the line 72ts/routes/deck-options/lib.tsThe problem seems not even be the overflow itself but the fact that
new_todayisNonein theLimitsobject (and notSome(0)as on the first save).If you fix the overflow by doing something like
limit.today = limit.today.min(today.max(1) - 1);, you are now stuck: you can not change theNew cards/daytoPreset, you are stuck on theToday only.On the 24.06.3 there is the same issue (without panic - only the
Today onlyhardlock/softlock):24_06_3_Demo.mp4
@dae, can you please investigate it?