Apply the intended ordering to scheduled words that are due - #731
Draft
mircealungu wants to merge 1 commit into
Draft
mircealungu wants to merge 1 commit into
mircealungu wants to merge 1 commit into
Conversation
scheduled_words_due_today and scheduled_words_due_now both called query.order_by(-Phrase.rank.desc(), cls.cooling_interval.desc()) and discarded the result. SQLAlchemy query methods return a new query rather than mutating in place, so the next line -- query.limit(...) / query.all() -- ran on the un-ordered query and the intended ordering was never applied to due words. Assign the result in both methods, matching how user_words_not_scheduled already chains the ordering into its query expression. Adds a regression test that schedules four due words with known ranks and cooling intervals and asserts they come back most-frequent-first, then by descending cooling interval, with unranked words last. The test fails without this change. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
ArchLens - No architecturally relevant changes to the existing views |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The bug
scheduled_words_due_todayandscheduled_words_due_nowinzeeguu/core/word_scheduling/basicSR/basicSR.pyboth did this:SQLAlchemy query methods return a new query; they do not mutate in place. The
order_byresult was thrown away, solimit/allran on the un-ordered query. The intended ordering — most frequent word first, then descendingcooling_intervalso words closest to being learned come first — has never been applied to due words.Compare
user_words_not_scheduled(basicSR.py:171-173), which builds the same ordering correctly by chaining it into the query expression.The fix
Assign the result of
order_byin both methods. Two lines. Nothing else changed.Test
Added
test_due_words_are_ordered_by_rank_then_cooling_intervaltozeeguu/core/test/test_scheduling.py. It schedules four due words with knownPhrase.rank/cooling_intervalvalues, created in an order that is deliberately not the expected one, and asserts bothscheduled_words_due_todayandscheduled_words_due_nowreturn them most-frequent-first, then by descending cooling interval, with the unranked word last.Verified the test fails on
master's version ofbasicSR.pyand passes with the fix.Test results:
zeeguu/core/test+zeeguu/api/test— 449 passed, 12 subtests passed, 0 failures. No pre-existing failures to report.This fix is correct in itself, but it will make an existing composition problem in the practice queue more visible, not less.
A separate investigation found that the practice queue admits unscheduled words ordered by ascending frequency rank (
basicSR.py:171-173). The effect is large:fit_for_studylooks at frequency at all. There is no gate that asks whether the learner already knows the word.Restoring the intended ordering for due words means those very frequent words will now be pushed to the front of each session instead of appearing in arbitrary order. The underlying problem is unchanged — the queue admits the same words either way — but the user-visible symptom gets sharper: sessions will more consistently open with words the learner already knows.
So there is a real choice here:
I have no view on which is right; that is a product call. Flagging it so the decision is made deliberately rather than discovered in user feedback.
🤖 Generated with Claude Code