mirror of
https://github.com/ankitects/anki.git
synced 2025-11-06 04:37:22 -05:00
Fix notetype original_stock_kind using wrong enum (#4382)
Use OriginalStockKind instead of StockKind when setting original_stock_kind for basic notetype variants. The two enums have different numeric values, causing 'Restore to Default' to restore the wrong template. For example, StockKind::BasicTyping has value 3, but when read back as OriginalStockKind, value 3 corresponds to BasicOptionalReversed instead of BasicTyping (which is 4). This fixes the off-by-one behavior where: - Basic (type in the answer) → Basic (optional reversed card) - Basic (and reversed card) → Basic (optional reversed card) - Basic (optional reversed card) → Basic (and reversed card) Fixes #4353
This commit is contained in:
parent
d11b74fd38
commit
76d3237139
2 changed files with 4 additions and 4 deletions
|
|
@ -249,7 +249,7 @@ Toby Penner <tobypenner01@gmail.com>
|
|||
Danilo Spillebeen <spillebeendanilo@gmail.com>
|
||||
Matbe766 <matildabergstrom01@gmail.com>
|
||||
Amanda Sternberg <mandis.sternberg@gmail.com>
|
||||
arold0 <arold0@icloud.com>
|
||||
arold0 <arold0@icloud.com>
|
||||
|
||||
|
||||
********************
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ pub(crate) fn basic(tr: &I18n) -> Notetype {
|
|||
|
||||
pub(crate) fn basic_typing(tr: &I18n) -> Notetype {
|
||||
let mut nt = basic(tr);
|
||||
nt.config.original_stock_kind = StockKind::BasicTyping as i32;
|
||||
nt.config.original_stock_kind = OriginalStockKind::BasicTyping as i32;
|
||||
nt.name = tr.notetypes_basic_type_answer_name().into();
|
||||
let front = tr.notetypes_front_field();
|
||||
let back = tr.notetypes_back_field();
|
||||
|
|
@ -138,7 +138,7 @@ pub(crate) fn basic_typing(tr: &I18n) -> Notetype {
|
|||
|
||||
pub(crate) fn basic_forward_reverse(tr: &I18n) -> Notetype {
|
||||
let mut nt = basic(tr);
|
||||
nt.config.original_stock_kind = StockKind::BasicAndReversed as i32;
|
||||
nt.config.original_stock_kind = OriginalStockKind::BasicAndReversed as i32;
|
||||
nt.name = tr.notetypes_basic_reversed_name().into();
|
||||
let front = tr.notetypes_front_field();
|
||||
let back = tr.notetypes_back_field();
|
||||
|
|
@ -156,7 +156,7 @@ pub(crate) fn basic_forward_reverse(tr: &I18n) -> Notetype {
|
|||
|
||||
pub(crate) fn basic_optional_reverse(tr: &I18n) -> Notetype {
|
||||
let mut nt = basic_forward_reverse(tr);
|
||||
nt.config.original_stock_kind = StockKind::BasicOptionalReversed as i32;
|
||||
nt.config.original_stock_kind = OriginalStockKind::BasicOptionalReversed as i32;
|
||||
nt.name = tr.notetypes_basic_optional_reversed_name().into();
|
||||
let addrev = tr.notetypes_add_reverse_field();
|
||||
nt.add_field(addrev.as_ref());
|
||||
|
|
|
|||
Loading…
Reference in a new issue