mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 08:22:24 -04:00
Assign dupe error the lowest precedence
This commit is contained in:
parent
0f549d2b82
commit
87a50f22e6
1 changed files with 12 additions and 7 deletions
|
@ -534,7 +534,7 @@ impl Collection {
|
|||
/// notetypes, check if there is a cloze in a non-cloze field or if there's
|
||||
/// no cloze at all. For other notetypes, just check if there's a cloze.
|
||||
pub(crate) fn note_fields_check(&mut self, note: &Note) -> Result<NoteFieldsState> {
|
||||
if let Some(text) = note.fields.get(0) {
|
||||
Ok(if let Some(text) = note.fields.get(0) {
|
||||
let field1 = if self.get_config_bool(BoolKey::NormalizeNoteText) {
|
||||
normalize_to_nfc(text)
|
||||
} else {
|
||||
|
@ -542,15 +542,20 @@ impl Collection {
|
|||
};
|
||||
let stripped = strip_html_preserving_media_filenames(&field1);
|
||||
if stripped.trim().is_empty() {
|
||||
Ok(NoteFieldsState::Empty)
|
||||
} else if self.is_duplicate(&stripped, note)? {
|
||||
Ok(NoteFieldsState::Duplicate)
|
||||
NoteFieldsState::Empty
|
||||
} else {
|
||||
self.field_cloze_check(note)
|
||||
let cloze_state = self.field_cloze_check(note)?;
|
||||
if cloze_state != NoteFieldsState::Normal {
|
||||
cloze_state
|
||||
} else if self.is_duplicate(&stripped, note)? {
|
||||
NoteFieldsState::Duplicate
|
||||
} else {
|
||||
NoteFieldsState::Normal
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Ok(NoteFieldsState::Empty)
|
||||
}
|
||||
NoteFieldsState::Empty
|
||||
})
|
||||
}
|
||||
|
||||
fn is_duplicate(&self, first_field: &str, note: &Note) -> Result<bool> {
|
||||
|
|
Loading…
Reference in a new issue