mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
cloze generation needs to use provided fields, not field 0
This commit is contained in:
parent
014dc3d987
commit
9fab2834da
1 changed files with 10 additions and 3 deletions
|
@ -509,9 +509,16 @@ select id from notes where mid = ?)""" % " ".join(map),
|
||||||
return avail
|
return avail
|
||||||
|
|
||||||
def _availClozeOrds(self, m, flds):
|
def _availClozeOrds(self, m, flds):
|
||||||
ret = [int(m)-1 for m in re.findall(
|
sflds = splitFields(flds)
|
||||||
"{{c(\d+)::[^}]*?}}", splitFields(flds)[0])]
|
map = self.fieldMap(m)
|
||||||
return list(set(ret))
|
ords = set()
|
||||||
|
for fname in re.findall("{{cloze:(.+?)}}", m['tmpls'][0]['qfmt']):
|
||||||
|
if fname not in map:
|
||||||
|
continue
|
||||||
|
ord = map[fname][0]
|
||||||
|
ords.update([int(m)-1 for m in re.findall(
|
||||||
|
"{{c(\d+)::[^}]*?}}", sflds[ord])])
|
||||||
|
return list(ords)
|
||||||
|
|
||||||
# Sync handling
|
# Sync handling
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
Loading…
Reference in a new issue