From c0e2a0ba502e14aa99e83db4cf8a87e0ba7e23c8 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 28 Nov 2011 16:05:37 +0900 Subject: [PATCH] identify whether it's a dupe or empty --- anki/notes.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/anki/notes.py b/anki/notes.py index 34afc2bd8..bc33649a4 100644 --- a/anki/notes.py +++ b/anki/notes.py @@ -132,17 +132,17 @@ insert or replace into notes values (?,?,?,?,?,?,?,?,?,?,?,?)""", ################################################## def dupeOrEmpty(self): - "True if first field is a duplicate or is empty." + "1 if first is empty; 2 if first is a duplicate, False otherwise." val = self.fields[0] if not val.strip(): - return True + return 1 csum = fieldChecksum(val) # find any matching csums and compare for flds in self.col.db.list( "select flds from notes where csum = ? and id != ? and mid = ?", csum, self.id or 0, self.mid): if splitFields(flds)[0] == self.fields[0]: - return True + return 2 return False # Flushing cloze notes