mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
fix case where multiple models have the same template
This commit is contained in:
parent
d6116a5377
commit
7ffff24790
1 changed files with 4 additions and 1 deletions
|
@ -164,6 +164,7 @@ order by %s""" % (lim, sort)
|
||||||
num = int(val) - 1
|
num = int(val) - 1
|
||||||
except:
|
except:
|
||||||
num = None
|
num = None
|
||||||
|
lims = []
|
||||||
for m in self.deck.models().values():
|
for m in self.deck.models().values():
|
||||||
for t in m.templates:
|
for t in m.templates:
|
||||||
# ordinal number?
|
# ordinal number?
|
||||||
|
@ -172,10 +173,12 @@ order by %s""" % (lim, sort)
|
||||||
found = True
|
found = True
|
||||||
# template name?
|
# template name?
|
||||||
elif t['name'].lower() == val.lower():
|
elif t['name'].lower() == val.lower():
|
||||||
self.lims['card'].append((
|
lims.append((
|
||||||
"(fid in (select id from facts where mid = %d) "
|
"(fid in (select id from facts where mid = %d) "
|
||||||
"and ord %s %d)") % (m.id, comp, t['ord']))
|
"and ord %s %d)") % (m.id, comp, t['ord']))
|
||||||
found = True
|
found = True
|
||||||
|
if lims:
|
||||||
|
self.lims['card'].append("(" + " or ".join(lims) + ")")
|
||||||
self.lims['valid'] = found
|
self.lims['valid'] = found
|
||||||
|
|
||||||
def _findField(self, token, isNeg):
|
def _findField(self, token, isNeg):
|
||||||
|
|
Loading…
Reference in a new issue