From 5db00d58158280c2e01ef5fa7e686b2792e168dc Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 1 Jun 2013 10:49:33 +0900 Subject: [PATCH] fix find dupes when fieldname case differs --- anki/find.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/anki/find.py b/anki/find.py index 16dd06896..5f638e8b0 100644 --- a/anki/find.py +++ b/anki/find.py @@ -523,13 +523,19 @@ def findDupes(col, fieldName, search=""): def ordForMid(mid): if mid not in fields: model = col.models.get(mid) - fields[mid] = col.models.fieldMap(model)[fieldName][0] + for c, f in enumerate(model['flds']): + if f['name'].lower() == fieldName.lower(): + fields[mid] = c + break return fields[mid] for nid, mid, flds in col.db.all( "select id, mid, flds from notes where id in "+ids2str( col.findNotes(search))): flds = splitFields(flds) - val = flds[ordForMid(mid)] + ord = ordForMid(mid) + if ord is None: + continue + val = flds[ord] # empty does not count as duplicate if not val: continue