Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvement(set-due-date): simplify for FSRS by removing "set interval to same value" #17708

Merged
merged 4 commits into from
Jan 5, 2025

Conversation

david-allison
Copy link
Member

Purpose / Description

I wanted to simplify the dialog, especially explaining what "set interval to same value" due to user feedback.

But, it didn't make sense to me for FSRS.

After a sufficiently long discussion with Expertium & Jarrett, we discovered:

Fixes

Approach

When FSRS is enabled, there is no reason for due date to be inconsistent with interval

So, hide 'set interval to same value' and use true

Confirmed by Jarrett and Expertium, paraphrased:

Expertium: when FSRS is enabled, is there any reason for keeping ivl not consistent with due date? Because I'm pretty sure there isn't
Jarrett: Yeah, there isn’t.

https://discord.com/channels/368267295601983490/1282005522513530952/1324758732122624020

How Has This Been Tested?

Logs when FSRS enabled:

16:48:23.999 Scheduler               com.ichi2.anki.debug                 I  updating due date of 1 card(s) to '12!'

When disabled and unticked

16:49:50.330 Scheduler               com.ichi2.anki.debug                 I  updating due date of 1 card(s) to '12'

Ticking the checkbox still works

Unit tests have been added

Screenshots:

Screenshot 2025-01-03 at 16 49 46 Screenshot 2025-01-03 at 16 48 14

Learning (optional, can help others)

Deep dives can improve the UX

Checklist

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

@david-allison david-allison marked this pull request as draft January 3, 2025 17:17
@david-allison david-allison added the Needs Author Reply Waiting for a reply from the original author label Jan 3, 2025
@david-allison

This comment has been minimized.

@david-allison david-allison added Needs Review and removed Needs Author Reply Waiting for a reply from the original author labels Jan 4, 2025
@david-allison david-allison marked this pull request as ready for review January 4, 2025 06:45
@david-allison
Copy link
Member Author

I would like to pay attention to comments on the issue, especially

Regarding the value of the checkbox:

FSRS user:

  • No effect on scheduling
  • Affects searching/sorting. But neither true nor false would result in correct behaviour. Correcting the sorting/searching requires either
    • changing value of ivl to the exact number of days between the due date and the last review date (43 days in my example above)
    • storing the value of LRD in the cards table, which dae has already agreed to.

I do believe that giving the user no choice, vs giving the user a choice where either outcome is incorrect is the best result

Jarrett agreed

In future, this should be fixed upstream. Hopefully in a manner where there is no need for the checkbox

@david-allison david-allison force-pushed the sdd branch 2 times, most recently from b6370a9 to c1e36f6 Compare January 4, 2025 10:17
Copy link
Member

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, +1 on the tests, awesome

@mikehardy mikehardy added Needs Second Approval Has one approval, one more approval to merge and removed Needs Review labels Jan 4, 2025
Useful if you want to assert on the exception message
It'll be used in the Set Due Date dialog for issue 17707
When FSRS is enabled, there is no reason
for due date to be inconsistent with interval

So, hide 'set interval to same value' and use `true`
as the default value
Property name: `updateIntervalToMatchDueDate`

Confirmed by Jarrett and Expertium paraphrased:

> Expertium: when FSRS is enabled, is there any reason for keeping `ivl`
  not consistent with due date? Because I'm pretty sure there isn't
> Jarrett: Yeah, there isn’t.

https://discord.com/channels/368267295601983490/1282005522513530952/1324758732122624020

The current backend implementation is not ideal:
* `1!` => interval is set to days from today, rather than days from last review
* `1` => interval does not match due date

So I suspect this will be improved upstream in the future

Fixes 17707
Copy link
Member

@lukstbit lukstbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Left one minor nitpick if you agree, merge at will otherwise.

const val MAX_WIDTH_DP = 450f

@CheckResult
fun newInstance(cardIds: List<CardId>) =
suspend fun newInstance(cardIds: List<CardId>) =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see why this method needs to be suspended. If the dialog requires the fsrs status(and it does) then I think this should be made obvious in the api by having the method receiving the value as a parameter. Call sites can do the required work to properly setup this dialog instead of hiding it here.

Would probably be useful for tests as well because we could avoid having to mock getFSRSStatus().

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it shouldn't be here, but it shouldn't be directly at the call site.

I wouldn't mind a new call, but it feels verbose.

If we moved to the call site:

  • Each call site would be executing the same code
  • FSRS status is system-supplied. The list of IDs is determined by the caller. The system supplied data isn't useful for the understanding of the code intent: "launch the dialog"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In terms of tests: we use the arguments, so no mocks are needed

@lukstbit lukstbit added Needs Author Reply Waiting for a reply from the original author Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) and removed Needs Second Approval Has one approval, one more approval to merge labels Jan 5, 2025
@david-allison david-allison added this pull request to the merge queue Jan 5, 2025
Merged via the queue into ankidroid:main with commit de66d74 Jan 5, 2025
9 checks passed
@github-actions github-actions bot removed Needs Author Reply Waiting for a reply from the original author Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) labels Jan 5, 2025
@github-actions github-actions bot added this to the 2.21 release milestone Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set Due Date: Hide 'set interval to same value' if FSRS is enabled
3 participants