Skip to content

fix(study-options): act on the deck the panel shows - #22847

Merged
BrayanDSO merged 1 commit into
ankidroid:mainfrom
criticalAY:fix/study-options-shown-deck
Oct 30, 2026
Merged

BrayanDSO merged 1 commit into
ankidroid:mainfrom
criticalAY:fix/study-options-shown-deck

Conversation

@criticalAY

Copy link
Copy Markdown
Contributor

Note

Assisted-by: Opus 5.5

Purpose / Description

In study options, Rebuild, Empty and Unbury acted on the collection's selected deck instead of the deck the screen shows. If the screen was out of date, they could act on a deck that wasn't shown.

Fixes

  • NA

Approach

They now use the shown deck (selectedDeckId), like Custom study, Deck options and Reminders already do.

How Has This Been Tested?

tests only

Learning (optional, can help others)

NA

Checklist

Please, go through these checks before submitting the PR.

  • 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

Rebuild, Empty and Unbury acted on the collection's selected deck,
while the panel's other actions use the deck it shows. If the panel
was out of date, for example after a failed refresh, they could act
on a deck that wasn't shown. They now act on the shown deck.

Assisted-by: Claude Opus 5.5
@github-actions

Copy link
Copy Markdown
Contributor

Snapshot diff report vs main. Open screenshot-diff for diffs.

  • CardBrowserScreenshotTest: 3 changes
All 3 changed screenshots

CardBrowserScreenshotTest

  • long_cells_collapsed_again_compare.png
  • long_cells_collapsed_compare.png
  • long_cells_expanded_compare.png

@mikehardy mikehardy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Assisted-by: grok-4.7

Thank you. Matching these three actions to Custom study, Deck options, and Reminders is the right cut, and the regression tests actually change the collection selection after the panel has captured its deck.

Locally I rebased the single commit onto current main and did not force-push. Lint (lintAll, ktlintCheck, lint-rules:test), unit (jacocoUnitTestReport), and emulator (TEST_RELEASE_BUILD=true via run_emulator_tests.py on emulator-5556 / API35_GAPI) all passed on the rebased tip.

selectedDeckId is flowOfSelectedDeckId.value, initial 0L. The only writer is Collection.updateStateFromCollection(), which assigns study.deckId from decks.current(). refreshData() is withOpenColOrNull { updateStateFromCollection() }; a closed collection leaves the previous id in place. rebuildCram and emptyCram run under progressManager.withProgress, then undoableOp { sched.rebuildFilteredDeck(selectedDeckId) } or emptyFilteredDeck(selectedDeckId), then withCol { updateStateFromCollection() }. unbury launches on viewModelScope and only runs undoableOp { sched.unburyDeck(selectedDeckId) }. The new empty, rebuild, and unbury tests set up deck divergence after refresh and assert only the captured deck changes.

some acceptable findings, no action required, just leaving for posterity: after Empty or Rebuild, updateStateFromCollection() still reads decks.current(); unbury() still does not refresh haveBuried or the study state.

Screenshot changes have been detected, so leaving this for a good manual look.

@mikehardy mikehardy added Needs Second Approval Has one approval, one more approval to merge and removed Needs Review labels Oct 29, 2026
@BrayanDSO

Copy link
Copy Markdown
Member

Great catch

@BrayanDSO
BrayanDSO added this pull request to the merge queue Oct 29, 2026
@BrayanDSO BrayanDSO added 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 Oct 29, 2026
Merged via the queue into ankidroid:main with commit e2035a9 Oct 30, 2026
25 checks passed
@github-actions github-actions Bot added this to the 2.26 release milestone Oct 30, 2026
@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 30, 2026
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.

3 participants