mirror of
https://github.com/ankitects/anki.git
synced 2025-11-08 21:57:12 -05:00
find duplicates support
This commit is contained in:
parent
d539018137
commit
00087ed101
1 changed files with 17 additions and 0 deletions
17
anki/deck.py
17
anki/deck.py
|
|
@ -2784,6 +2784,23 @@ select id from facts where spaceUntil like :_ff_%d escape '\\'""" % c
|
|||
type="facts")
|
||||
return len(set([f['fid'] for f in modded]))
|
||||
|
||||
# Find duplicates
|
||||
##########################################################################
|
||||
|
||||
def findDuplicates(self, fmids):
|
||||
data = self.s.all(
|
||||
"select factId, value from fields where fieldModelId in %s" %
|
||||
ids2str(fmids))
|
||||
vals = {}
|
||||
for (fid, val) in data:
|
||||
if not val.strip():
|
||||
continue
|
||||
if val not in vals:
|
||||
vals[val] = [fid]
|
||||
else:
|
||||
vals[val].append(fid)
|
||||
return [(k,v) for (k,v) in vals.items() if len(v) > 1]
|
||||
|
||||
# Progress info
|
||||
##########################################################################
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue