mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
Log existing notes during CSV import (#2898)
This commit is contained in:
parent
f2e9c73b31
commit
8537e85a64
1 changed files with 7 additions and 9 deletions
|
@ -335,16 +335,18 @@ impl<'a> Context<'a> {
|
|||
|
||||
fn import_note(&mut self, ctx: NoteContext, log: &mut NoteLog) -> Result<()> {
|
||||
match self.dupe_resolution {
|
||||
_ if !ctx.is_dupe() => self.add_note(ctx, log)?,
|
||||
DupeResolution::Duplicate if ctx.is_guid_dupe() => {
|
||||
log.duplicate.push(ctx.note.into_log_note())
|
||||
}
|
||||
_ if ctx.dupes.is_empty() => self.add_note(ctx, log)?,
|
||||
DupeResolution::Duplicate if ctx.is_guid_dupe() => log
|
||||
.duplicate
|
||||
.push(ctx.dupes.into_iter().next().unwrap().note.into_log_note()),
|
||||
DupeResolution::Duplicate if !ctx.has_first_field() => {
|
||||
log.empty_first_field.push(ctx.note.into_log_note())
|
||||
}
|
||||
DupeResolution::Duplicate => self.add_note(ctx, log)?,
|
||||
DupeResolution::Update => self.update_with_note(ctx, log)?,
|
||||
DupeResolution::Preserve => log.first_field_match.push(ctx.note.into_log_note()),
|
||||
DupeResolution::Preserve => log
|
||||
.first_field_match
|
||||
.push(ctx.dupes.into_iter().next().unwrap().note.into_log_note()),
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
@ -479,10 +481,6 @@ impl DuplicateUpdateResult {
|
|||
}
|
||||
|
||||
impl NoteContext<'_> {
|
||||
fn is_dupe(&self) -> bool {
|
||||
!self.dupes.is_empty()
|
||||
}
|
||||
|
||||
fn is_guid_dupe(&self) -> bool {
|
||||
self.dupes
|
||||
.get(0)
|
||||
|
|
Loading…
Reference in a new issue