kerrickstaley / genanki

A Python 3 library for generating Anki decks
MIT License
2.06k stars 161 forks source link

Add "Back Extra" field to Cloze builtin model #101

Closed kerrickstaley closed 2 years ago

kerrickstaley commented 2 years ago

Due to a mistake, the "Back Extra" field was omitted from genanki.builtin_models.CLOZE_MODEL. This field shows extra information on the back of the card.

Add this field to CLOZE_MODEL. Also, add some code that runs inside Note.write_to_db that checks if .fields has only one element and .model is CLOZE_MODEL, and if so, fixes .fields and emits a warning.

This change may cause minor backwards-incompatibility issues, because the ID of CLOZE_MODEL has changed. The only visible effect should be that a deck of Cloze notes created before this change and a similar deck created after this change will have different Note Types when both are imported into Anki. (Note Type is the Anki UI's term for what the source code calls Model).

codecov-commenter commented 2 years ago

Codecov Report

Merging #101 (e1369a9) into master (e308e37) will increase coverage by 0.12%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #101      +/-   ##
==========================================
+ Coverage   95.28%   95.41%   +0.12%     
==========================================
  Files          11       11              
  Lines         318      327       +9     
==========================================
+ Hits          303      312       +9     
  Misses         15       15              
Impacted Files Coverage Δ
genanki/builtin_models.py 100.00% <100.00%> (ø)
genanki/note.py 97.45% <100.00%> (+0.04%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e308e37...e1369a9. Read the comment docs.