diff --git a/ts/graphs/reviews.ts b/ts/graphs/reviews.ts index a48c1e49f..92bb53388 100644 --- a/ts/graphs/reviews.ts +++ b/ts/graphs/reviews.ts @@ -8,10 +8,10 @@ import pb from "anki/backend_proto"; import { - interpolateBlues, interpolateGreens, interpolateReds, interpolateOranges, + interpolatePurples, } from "d3-scale-chromatic"; import "d3-transition"; import { select, mouse } from "d3-selection"; @@ -26,10 +26,10 @@ import { timeSpan, dayLabel } from "anki/time"; import type { I18n } from "anki/i18n"; interface Reviews { - mature: number; - young: number; learn: number; relearn: number; + young: number; + mature: number; early: number; } @@ -61,6 +61,14 @@ export function gatherData(data: pb.BackendProto.GraphsOut): GraphData { reviewTime.get(day) ?? reviewTime.set(day, { ...empty }).get(day)!; switch (review.reviewKind) { + case ReviewKind.LEARNING: + countEntry.learn += 1; + timeEntry.learn += review.takenMillis; + break; + case ReviewKind.RELEARNING: + countEntry.relearn += 1; + timeEntry.relearn += review.takenMillis; + break; case ReviewKind.REVIEW: if (review.lastInterval < 21) { countEntry.young += 1; @@ -70,14 +78,6 @@ export function gatherData(data: pb.BackendProto.GraphsOut): GraphData { timeEntry.mature += review.takenMillis; } break; - case ReviewKind.LEARNING: - countEntry.learn += 1; - timeEntry.learn += review.takenMillis; - break; - case ReviewKind.RELEARNING: - countEntry.relearn += 1; - timeEntry.relearn += review.takenMillis; - break; case ReviewKind.EARLY_REVIEW: countEntry.early += 1; timeEntry.early += review.takenMillis; @@ -91,10 +91,10 @@ export function gatherData(data: pb.BackendProto.GraphsOut): GraphData { function totalsForBin(bin: BinType): number[] { const total = [0, 0, 0, 0, 0]; for (const entry of bin) { - total[0] += entry[1].mature; - total[1] += entry[1].young; - total[2] += entry[1].learn; - total[3] += entry[1].relearn; + total[0] += entry[1].learn; + total[1] += entry[1].relearn; + total[2] += entry[1].young; + total[3] += entry[1].mature; total[4] += entry[1].early; } @@ -204,15 +204,15 @@ export function renderReviews( const lighterGreens = scaleSequential((n) => interpolateGreens(cappedRange(n)!) ).domain(x.domain() as any); - const blues = scaleSequential((n) => interpolateBlues(cappedRange(n)!)).domain( - x.domain() as any - ); const reds = scaleSequential((n) => interpolateReds(cappedRange(n)!)).domain( x.domain() as any ); const oranges = scaleSequential((n) => interpolateOranges(cappedRange(n)!)).domain( x.domain() as any ); + const purples = scaleSequential((n) => interpolatePurples(cappedRange(n)!)).domain( + x.domain() as any + ); function valueLabel(n: number): string { if (showTime) { @@ -229,27 +229,27 @@ export function renderReviews( let buf = `
${day} | ${dayTotal} |