use default deck for new note types
This commit is contained in:
parent
15ff279a96
commit
5c3e5c672f
@ -179,6 +179,7 @@ mod test {
|
||||
use super::{anki_base91, field_checksum};
|
||||
use crate::{
|
||||
collection::open_test_collection,
|
||||
decks::DeckID,
|
||||
err::{AnkiError, Result},
|
||||
search::SortMode,
|
||||
};
|
||||
@ -226,9 +227,7 @@ mod test {
|
||||
let existing = col.storage.existing_cards_for_note(note.id)?;
|
||||
assert_eq!(existing.len(), 1);
|
||||
assert_eq!(existing[0].ord, 0);
|
||||
|
||||
// fixme
|
||||
// assert_eq!(existing[0].original_deck_id, DeckID(1));
|
||||
assert_eq!(existing[0].original_deck_id, DeckID(1));
|
||||
|
||||
note.fields[0] = "{{c1::foo}} {{c2::bar}} {{c3::baz}} {{c0::quux}} {{c501::over}}".into();
|
||||
col.update_note(&mut note)?;
|
||||
|
@ -239,6 +239,7 @@ impl Collection {
|
||||
) -> Result<()> {
|
||||
let mut next_pos = None;
|
||||
for c in cards {
|
||||
// fixme: deal with case where invalid deck pointed to
|
||||
let did = c.did.unwrap_or_else(|| ctx.notetype.target_deck_id());
|
||||
let due = c.due.unwrap_or_else(|| {
|
||||
if next_pos.is_none() {
|
||||
@ -253,6 +254,3 @@ impl Collection {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
// fixme: deal with case where invalid deck pointed to
|
||||
// fixme: make sure we don't orphan notes
|
||||
|
@ -167,6 +167,8 @@ impl NoteType {
|
||||
}
|
||||
|
||||
pub(crate) fn prepare_for_adding(&mut self) {
|
||||
// defaults to 0
|
||||
self.config.target_deck_id = 1;
|
||||
self.normalize_names();
|
||||
self.ensure_names_unique();
|
||||
self.update_requirements();
|
||||
|
@ -239,3 +239,6 @@ mod test {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// fixme: make sure we don't orphan notes
|
||||
|
Loading…
Reference in New Issue
Block a user