mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
drop data from renderQA
This commit is contained in:
parent
45d1b788ea
commit
2c545cfb1d
2 changed files with 9 additions and 9 deletions
|
@ -111,7 +111,7 @@ streak=?, lapses=?, grade=?, cycles=?, edue=? where id = ?""",
|
|||
"select name from groups where id = ?", self.gid)
|
||||
f = self.fact(); m = self.model()
|
||||
data = [self.id, f.id, m.id, self.gid, self.ord, f.stringTags(),
|
||||
f.joinedFields(), ""]
|
||||
f.joinedFields()]
|
||||
self._qa = self.deck._renderQA(self.model(), gname, data)
|
||||
return self._qa
|
||||
|
||||
|
|
16
anki/deck.py
16
anki/deck.py
|
@ -252,9 +252,9 @@ select id from facts where id not in (select distinct fid from cards)""")
|
|||
model = fact.model()
|
||||
for template in model.templates:
|
||||
if template['actv'] or not checkActive:
|
||||
# [cid, fid, mid, gid, ord, tags, flds, data]
|
||||
# [cid, fid, mid, gid, ord, tags, flds]
|
||||
data = [1, 1, model.id, 1, template['ord'],
|
||||
"", fact.joinedFields(), ""]
|
||||
"", fact.joinedFields()]
|
||||
now = self._renderQA(model, "", data)
|
||||
data[6] = "\x1f".join([""]*len(fact._fields))
|
||||
empty = self._renderQA(model, "", data)
|
||||
|
@ -441,9 +441,9 @@ select id from cards where fid in (select id from facts where mid = ?)""",
|
|||
# fixme: don't need gid or data
|
||||
def _renderQA(self, model, gname, data):
|
||||
"Returns hash of id, question, answer."
|
||||
# data is [cid, fid, mid, gid, ord, tags, flds, data]
|
||||
# data is [cid, fid, mid, gid, ord, tags, flds]
|
||||
# unpack fields and create dict
|
||||
flist = data[6].split("\x1f")
|
||||
flist = splitFields(data[6])
|
||||
fields = {}
|
||||
for (name, (idx, conf)) in model.fieldMap().items():
|
||||
fields[name] = flist[idx]
|
||||
|
@ -470,11 +470,11 @@ select id from cards where fid in (select id from facts where mid = ?)""",
|
|||
return d
|
||||
|
||||
def _qaData(self, where=""):
|
||||
"Return [cid, fid, mid, gid, ord, tags, flds, data] db query"
|
||||
"Return [cid, fid, mid, gid, ord, tags, flds] db query"
|
||||
return self.db.execute("""
|
||||
select c.id, f.id, m.id, g.id, c.ord, f.tags, f.flds, f.data
|
||||
from cards c, facts f, models m, groups g
|
||||
where c.fid == f.id and f.mid == m.id and c.gid = g.id
|
||||
select c.id, f.id, f.mid, c.gid, c.ord, f.tags, f.flds
|
||||
from cards c, facts f
|
||||
where c.fid == f.id
|
||||
%s""" % where)
|
||||
|
||||
# Tags
|
||||
|
|
Loading…
Reference in a new issue