From 2860b3222225e9dd95c0a3493c9238e4d572fe97 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 17 Aug 2009 06:45:59 +0900 Subject: [PATCH] fix sort by fact created --- ankiqt/ui/cardlist.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ankiqt/ui/cardlist.py b/ankiqt/ui/cardlist.py index 1e1fd3e58..6cce7f791 100644 --- a/ankiqt/ui/cardlist.py +++ b/ankiqt/ui/cardlist.py @@ -33,6 +33,7 @@ CARD_EASE = 9 CARD_NO = 10 CARD_PRIORITY = 11 CARD_TAGS = 12 +CARD_FACTCREATED = 13 # Deck editor ########################################################################## @@ -174,6 +175,7 @@ where cards.factId = facts.id """ self.cards[index.row()] = self.deck.s.first(""" select id, question, answer, due, reps, factId, created, modified, interval, factor, noCount, priority, (select tags from facts where +facts.id = cards.factId), (select created from facts where facts.id = cards.factId) from cards where id = :id""", id=self.cards[index.row()][0]) self.emit(SIGNAL("dataChanged(QModelIndex,QModelIndex)"), @@ -229,6 +231,8 @@ facts.id = cards.factId) from cards where id = :id""", return self.easeColumn(index) elif self.sortKey == "noCount": return self.noColumn(index) + elif self.sortKey == "fact": + return self.factCreatedColumn(index) else: return self.nextDue(index) @@ -245,6 +249,8 @@ facts.id = cards.factId) from cards where id = :id""", k = _("Ease") elif self.sortKey == "noCount": k = _("Lapses") + elif self.sortKey == "fact": + k = _("Fact Created") else: k = _("Due") self.columns[-1][0] = k @@ -253,6 +259,10 @@ facts.id = cards.factId) from cards where id = :id""", return time.strftime("%Y-%m-%d", time.localtime( self.cards[index.row()][CARD_CREATED])) + def factCreatedColumn(self, index): + return time.strftime("%Y-%m-%d", time.localtime( + self.cards[index.row()][CARD_FACTCREATED])) + def modifiedColumn(self, index): return time.strftime("%Y-%m-%d", time.localtime( self.cards[index.row()][CARD_MODIFIED]))