Skip to content

Commit

Permalink
fix: 'rebuild' did not update the deck UI
Browse files Browse the repository at this point in the history
Issue 14285
  • Loading branch information
david-allison authored and lukstbit committed Aug 27, 2023
1 parent 6284759 commit ad5b20b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
17 changes: 10 additions & 7 deletions AnkiDroid/src/main/java/com/ichi2/anki/DeckPicker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2288,13 +2288,16 @@ open class DeckPicker :
}
}

suspend fun rebuildFiltered(did: DeckId) {
withProgress(resources.getString(R.string.rebuild_filtered_deck)) {
withCol {
Timber.d("rebuildFiltered: doInBackground - RebuildCram")
decks.select(did)
sched.rebuildDyn(decks.selected())
updateValuesFromDeck(this, true)
@NeedsTest("14285: regression test to ensure UI is updated after this call")
fun rebuildFiltered(did: DeckId) {
launchCatchingTask {
withProgress(resources.getString(R.string.rebuild_filtered_deck)) {
withCol {
Timber.d("rebuildFiltered: doInBackground - RebuildCram")
decks.select(did)
sched.rebuildDyn(decks.selected())
updateValuesFromDeck(this, true)
}
}
updateDeckList()
if (fragmented) loadStudyOptionsFragment(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import com.ichi2.anki.DeckPicker
import com.ichi2.anki.R
import com.ichi2.anki.analytics.AnalyticsDialogFragment
import com.ichi2.anki.dialogs.customstudy.CustomStudyDialog
import com.ichi2.anki.launchCatchingTask
import com.ichi2.libanki.Collection
import com.ichi2.libanki.DeckId
import com.ichi2.utils.BundleUtils.requireLong
Expand Down Expand Up @@ -139,7 +138,7 @@ class DeckPickerContextMenu(private val collection: Collection) : AnalyticsDialo
}
DeckPickerContextMenuOption.CUSTOM_STUDY_REBUILD -> {
Timber.i("Rebuild deck selected")
launchCatchingTask { activity.rebuildFiltered(deckId) }
activity.rebuildFiltered(deckId)
activity.dismissAllDialogFragments()
}
DeckPickerContextMenuOption.CUSTOM_STUDY_EMPTY -> {
Expand Down

0 comments on commit ad5b20b

Please sign in to comment.