add capitalized tags field, don't use cardmodelname in tags

This commit is contained in:
Damien Elmes 2008-11-14 14:33:11 +09:00
parent 7c630b9805
commit 6658b47661
2 changed files with 11 additions and 2 deletions

View file

@ -1134,7 +1134,8 @@ facts.modelId = :id""", id=model.id)
else:
mod = ""
# tags
tags = dict(self.tagsList(priority="", where="and cards.id in %s" %
tags = dict(self.shortTagsList(
where="and cards.id in %s" %
ids2str([x[0] for x in ids])))
facts = {}
# fields
@ -1180,6 +1181,13 @@ cardModels.name %s from cards, facts, models, cardModels where
cards.factId == facts.id and facts.modelId == models.id
and cards.cardModelId = cardModels.id %s""" % (priority, where))
def shortTagsList(self, where=""):
return self.s.all("""
select cards.id, cards.tags || "," || facts.tags || "," || models.tags
from cards, facts, models where
cards.factId == facts.id and facts.modelId == models.id
%s""" % where)
def allTags(self):
"Return a hash listing tags in model, fact and cards."
return list(set(parseTags(",".join([x[1] for x in self.tagsList()]))))

View file

@ -119,6 +119,7 @@ def formatQA(cid, mid, fact, tags, cm):
fields[k] = '<span class="fm%s">%s</span>' % (
hexifyID(v[0]), v[1])
fields['tags'] = canonifyTags(tags)
fields['Tags'] = fields['tags']
# render q & a
ret = []
for (type, format) in (("question", cm.qformat),