Fix deck day limits incorrectly being carried over when importing #3878
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For ergonomics, day limits aren't cleared* when not used. Instead, a hack is used whereby its set as if it were in the past and thus not applicable on the current day
This is problematic when importing because the current day depends on the collection's age, and so an imported deck's "past" day limit might fall within the importing collection's "future" if the importing col is newer
This means that the imported deck's today limit might turn itself on in the future, even if it was considered to be a past value when the deck was exported. Or, more commonly, when importing a deck that has a valid today limit in the orig col, it isn't applied because the importing col has a different today.
This pr proposes to fix that by
shiftingcorrecting the day limit datesbackaccordingly** when importing, or removing them if the situation described in #3877 would occur.Sorry in advance if i've screwed up the math, it's a bit confusingEDIT: used a simpler approach that should also be more consistent*changed in #3877, but the problem described here remains
**analogous to
shifting backcorrecting imported cards' due dates