mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
fix group tree when no cards use a group
This commit is contained in:
parent
95b3f60353
commit
673913a2a8
3 changed files with 4 additions and 3 deletions
|
@ -13,7 +13,8 @@ from anki.media import MediaRegistry
|
||||||
from anki.consts import *
|
from anki.consts import *
|
||||||
|
|
||||||
import anki.latex # sets up hook
|
import anki.latex # sets up hook
|
||||||
import anki.cards, anki.facts, anki.models, anki.template, anki.cram
|
import anki.cards, anki.facts, anki.models, anki.template, anki.cram, \
|
||||||
|
anki.groups
|
||||||
|
|
||||||
# Settings related to queue building. These may be loaded without the rest of
|
# Settings related to queue building. These may be loaded without the rest of
|
||||||
# the config to check due counts faster on mobile clients.
|
# the config to check due counts faster on mobile clients.
|
||||||
|
|
|
@ -124,7 +124,7 @@ sum(case when queue = 2 and due <= ? then 1 else 0 end),
|
||||||
sum(case when queue = 0 then 1 else 0 end)
|
sum(case when queue = 0 then 1 else 0 end)
|
||||||
from cards group by gid""", self.today):
|
from cards group by gid""", self.today):
|
||||||
gids[gid] = [all, rev, new]
|
gids[gid] = [all, rev, new]
|
||||||
return [[name, gid]+gids[gid] for (gid, name) in
|
return [[name, gid]+gids.get(gid, [0, 0, 0]) for (gid, name) in
|
||||||
self.deck.db.execute(
|
self.deck.db.execute(
|
||||||
"select id, name from groups order by name")]
|
"select id, name from groups order by name")]
|
||||||
|
|
||||||
|
|
|
@ -202,7 +202,7 @@ def joinTags(tags):
|
||||||
return u" %s " % u" ".join(tags)
|
return u" %s " % u" ".join(tags)
|
||||||
|
|
||||||
def canonifyTags(tags):
|
def canonifyTags(tags):
|
||||||
"Strip leading/trailing/superfluous commas and duplicates."
|
"Strip leading/trailing/superfluous spaces and duplicates."
|
||||||
tags = [t.lstrip(":") for t in set(tags)]
|
tags = [t.lstrip(":") for t in set(tags)]
|
||||||
return joinTags(sorted(tags))
|
return joinTags(sorted(tags))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue