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

Refactor ForgetCardsDialog and potentially fix a bug #17176

Merged
merged 2 commits into from
Oct 3, 2024

Conversation

lukstbit
Copy link
Member

@lukstbit lukstbit commented Oct 1, 2024

Purpose / Description

First commit is a refactoring for the code around ForgetCardsDialog, looked verbose for what it was doing.

Second commit is an attempt to fix the linked issue. With that change when the current card's progress is reset the reviewer removes the card and changes the counts. This seems to be the behavior on desktop, at least from what I saw. I'm not sure about this, but I also don't see any issues with having that call in production.

There are no UI changes but just to be transparent:

screenshot

Fixes

How Has This Been Tested?

Ran the tests, everything seems to work.

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

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.

FWIW I'm okay with both the refactor (despite its size) and of course the bug fix (that one is tiny + appears obvious in diff view)

@mikehardy mikehardy added Needs Second Approval Has one approval, one more approval to merge and removed Needs Review labels Oct 1, 2024
Copy link
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

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

Refactoring is great

One question from an unusual, but correct line of code

Treat this as an approval if either a comment is added, or undoableOp is used

@david-allison david-allison added the Needs Author Reply Waiting for a reply from the original author label Oct 2, 2024
The refactoring mainly removes the associated ViewModel as it only had
two simple properties and a method to call an activity method to do
its work.

ForgetCardsDialog was refactored:
- simplify the dialog customization
- simplify the dialog itself by removing the need to pass the target
cards ids. With these changes the dialog becomes a simple UI panel
from which the user to select his desired options. The cards ids are
fetched by the activity itself when they are actually needed
- use modern communication(FragmentResult) between the dialog fragment
and the holder activity doing the work
- create utility methods so activities using the dialog can easily
do so
The call scheduler.forgetCards() produces OpChanges for:

browser_table: true
card: true
mtime: true
study_queues: true
@lukstbit lukstbit added Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) and removed Needs Author Reply Waiting for a reply from the original author Needs Second Approval Has one approval, one more approval to merge labels Oct 3, 2024
@lukstbit lukstbit dismissed david-allison’s stale review October 3, 2024 05:13

Review request was handled, used undoableOp

@lukstbit lukstbit added this pull request to the merge queue Oct 3, 2024
Merged via the queue into ankidroid:main with commit 57a1e86 Oct 3, 2024
9 checks passed
@github-actions github-actions bot removed the Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) label Oct 3, 2024
@github-actions github-actions bot added this to the 2.19 release milestone Oct 3, 2024
@lukstbit lukstbit deleted the refactor_forgetCardsDialog branch October 3, 2024 05:32
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.

[BUG]: "Reset progress" can't work in Reviewer on the spot and causes error
3 participants