mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
Fix due graph showing wrong date for review cards with resched off
Since we are using the original due date instead of the current one, the learning check needs to be based on the card type, not its current queue. https://forums.ankiweb.net/t/anki-2-1-51-release-candidate/18942/22
This commit is contained in:
parent
b8eabfd622
commit
f60de39015
1 changed files with 9 additions and 13 deletions
|
@ -16,7 +16,7 @@ import {
|
|||
sum,
|
||||
} from "d3";
|
||||
|
||||
import { CardQueue } from "../lib/cards";
|
||||
import { CardType } from "../lib/cards";
|
||||
import * as tr from "../lib/ftl";
|
||||
import { localizedNumber } from "../lib/i18n";
|
||||
import type { Cards, Stats } from "../lib/proto";
|
||||
|
@ -31,19 +31,15 @@ export interface GraphData {
|
|||
}
|
||||
|
||||
export function gatherData(data: Stats.GraphsResponse): GraphData {
|
||||
const isLearning = (card: Cards.Card): boolean =>
|
||||
[CardQueue.Learn, CardQueue.PreviewRepeat].includes(card.queue);
|
||||
|
||||
const isIntradayLearning = (card: Cards.Card, due: number): boolean => {
|
||||
return (
|
||||
[CardType.Learn, CardType.Relearn].includes(card.ctype) &&
|
||||
due > 1_000_000_000
|
||||
);
|
||||
};
|
||||
let haveBacklog = false;
|
||||
const due = (data.cards as Cards.Card[])
|
||||
.filter((c: Cards.Card) => {
|
||||
// reviews
|
||||
return (
|
||||
[CardQueue.Review, CardQueue.DayLearn].includes(c.queue) ||
|
||||
// or learning cards
|
||||
isLearning(c)
|
||||
);
|
||||
})
|
||||
.filter((c: Cards.Card) => c.queue >= 0)
|
||||
.map((c: Cards.Card) => {
|
||||
// - testing just odue fails on day 1
|
||||
// - testing just odid fails on lapsed cards that
|
||||
|
@ -51,7 +47,7 @@ export function gatherData(data: Stats.GraphsResponse): GraphData {
|
|||
const due = c.originalDeckId && c.originalDue ? c.originalDue : c.due;
|
||||
|
||||
let dueDay: number;
|
||||
if (isLearning(c)) {
|
||||
if (isIntradayLearning(c, due)) {
|
||||
const offset = due - data.nextDayAtSecs;
|
||||
dueDay = Math.floor(offset / 86_400) + 1;
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue