mirror of
https://github.com/ankitects/anki.git
synced 2026-07-28 12:38:46 -04:00
## Linked issue (required) Fixes #4750 ## Summary / motivation (required) `new_cards_required_normal()` builds a set of non-empty fields from the note's actual fields, but only special-cases `Tags`. Other special fields like `Deck`, `Subdeck`, `Card`, `CardFlag`, `Type`, and `CardID` are always populated at render time but were missing from this set. This caused `{{^Deck}}` conditionals to be incorrectly evaluated as potentially rendering, making cards appear non-empty to the checker. The fix adds all always-present special fields to `nonempty_fields`. ## Steps to reproduce (required) 1. Create a Basic (and reversed card) note with content in both fields 2. Change Card 1's front template to `{{^Deck}}{{Back}}{{/Deck}}` 3. Observe the previewer shows a blank card 4. Run Tools → Check → Empty Cards — no empty cards are reported ## How to test (required) Run `./ninja check:pytest` — a new regression test `test_empty_cards_special_fields` in `pylib/tests/test_cards.py` covers this case. ### Checklist (minimum) - [x] I ran `./ninja check` or an equivalent relevant check locally. - [x] I added or updated tests when the change is non-trivial or behavior changed. ### Details New test verifies that a card with `{{^Deck}}{{Back}}{{/Deck}}` as its front template is correctly detected as empty. ## Before / after behavior (optional) Before: cards using special field conditionals like `{{^Deck}}` were not detected as empty. After: they are correctly flagged. ## Risk / compatibility / migration (optional) Low risk. Only affects empty card detection logic, not card rendering or scheduling. ## UI evidence (required for visual changes; otherwise N/A) N/A ## Scope - [x] This PR is focused on one change (no unrelated edits).