make sure deck is saved before cram, fix bug with no matching tags

This commit is contained in:
Damien Elmes 2009-01-31 16:04:19 +09:00
parent dd83f7a2de
commit 50fa426058

View file

@ -1359,12 +1359,13 @@ day = :d""", d=yesterday)
ui.utils.showInfo( ui.utils.showInfo(
_("Already cramming. Please close this deck first.")) _("Already cramming. Please close this deck first."))
return return
if not self.save(required=True):
return
(s, ret) = ui.utils.getTag(self, self.deck, _("Tags to cram:"), (s, ret) = ui.utils.getTag(self, self.deck, _("Tags to cram:"),
help="CramMode", tags="all") help="CramMode", tags="all")
if not ret: if not ret:
return return
s = unicode(s) s = unicode(s)
self.deck.save()
# open tmp deck # open tmp deck
ndir = tempfile.mkdtemp(prefix="anki") ndir = tempfile.mkdtemp(prefix="anki")
path = os.path.join(ndir, "cram.anki") path = os.path.join(ndir, "cram.anki")
@ -1376,7 +1377,6 @@ day = :d""", d=yesterday)
e.exportInto(path) e.exportInto(path)
if not e.exportedCards: if not e.exportedCards:
ui.utils.showInfo(_("No cards matched the provided tags.")) ui.utils.showInfo(_("No cards matched the provided tags."))
p.finish()
return return
if self.config['randomizeOnCram']: if self.config['randomizeOnCram']:
n = 4 n = 4