0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-20 03:52:15 +02:00

Don't count 'forget' and 'set due date' cards as reviews (#8591)

* don't count 'forget' and 'set due date' cards as reviews
* use type instead of time to find rescheduled cards
* use ease instead of type to exclude rescheduled cards
This commit is contained in:
Thore 2021-06-28 17:37:20 +02:00 committed by GitHub
parent 0fd714aa3a
commit a06e6a0de9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -247,7 +247,8 @@ public class AnkiStatsTaskHandler {
//eventually put this in Stats (in desktop it is not though)
int cards;
int minutes;
String query = "select count(), sum(time)/1000 from revlog where id > " + ((collection.getSched().getDayCutoff() - SECONDS_PER_DAY) * 1000);
String query = "select sum(case when ease > 0 then 1 else 0 end), "+ /* cards, excludes rescheduled cards https://github.com/ankidroid/Anki-Android/issues/8592 */
"sum(time)/1000 from revlog where id > " + ((collection.getSched().getDayCutoff() - SECONDS_PER_DAY) * 1000);
Timber.d("DeckPreviewStatistics query: %s", query);
try (Cursor cur = collection.getDb()

View File

@ -132,7 +132,8 @@ public class Stats {
lim = " and " + lim;
}
String query = "select count(), sum(time)/1000, "+
String query = "select sum(case when ease > 0 then 1 else 0 end), "+ /* cards, excludes rescheduled cards https://github.com/ankidroid/Anki-Android/issues/8592 */
"sum(time)/1000, "+ /*time*/
"sum(case when ease = 1 then 1 else 0 end), "+ /* failed */
"sum(case when type = " + Consts.CARD_TYPE_NEW + " then 1 else 0 end), "+ /* learning */
"sum(case when type = " + Consts.CARD_TYPE_LRN + " then 1 else 0 end), "+ /* review */
@ -140,7 +141,7 @@ public class Stats {
"sum(case when type = " + Consts.CARD_TYPE_RELEARNING + " then 1 else 0 end) "+ /* filter */
"from revlog "+
"where ease > 0 "+ // Anki Desktop logs a '0' ease for manual reschedules, ignore them https://github.com/ankidroid/Anki-Android/issues/8008
"and id > " + ((mCol.getSched().getDayCutoff()-SECONDS_PER_DAY)*1000) + " " + lim;
"and id > " + ((mCol.getSched().getDayCutoff() - SECONDS_PER_DAY) * 1000) + " " + lim;
Timber.d("todays statistics query: %s", query);
int cards, thetime, failed, lrn, rev, relrn, filt;
@ -159,9 +160,10 @@ public class Stats {
}
query = "select count(), sum(case when ease = 1 then 0 else 1 end) from revlog " +
query = "select sum(case when ease > 0 then 1 else 0 end), "+ /* cards, excludes rescheduled cards https://github.com/ankidroid/Anki-Android/issues/8592 */
"sum(case when ease = 1 then 0 else 1 end) from revlog " +
"where ease > 0 "+ // Anki Desktop logs a '0' ease for manual reschedules, ignore them https://github.com/ankidroid/Anki-Android/issues/8008
"and lastIvl >= 21 and id > " + ((mCol.getSched().getDayCutoff()-SECONDS_PER_DAY)*1000) + " " + lim;
"and lastIvl >= 21 and id > " + ((mCol.getSched().getDayCutoff() - SECONDS_PER_DAY) * 1000) + " " + lim;
Timber.d("todays statistics query 2: %s", query);
int mcnt, msum;