From cb3c3cdc2d385fecd3981d59bd63179ee182b363 Mon Sep 17 00:00:00 2001 From: user1823 <92206575+user1823@users.noreply.github.com> Date: Sun, 15 Jun 2025 13:05:23 +0530 Subject: [PATCH] Limit study time to hours in reviews graph Relevant discussions: - https://forums.ankiweb.net/t/reviews-graph-units-of-total-time-studied-suggestion/61237 - https://forums.ankiweb.net/t/why-does-anki-display-study-time-in-months/37722 - https://forums.ankiweb.net/t/poll-use-hours-in-total-time-stats/62076 - https://github.com/ankitects/anki/pull/3901#issuecomment-2973161601 --- ts/routes/graphs/reviews.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ts/routes/graphs/reviews.ts b/ts/routes/graphs/reviews.ts index 2d590e3fb..164fc4199 100644 --- a/ts/routes/graphs/reviews.ts +++ b/ts/routes/graphs/reviews.ts @@ -8,7 +8,7 @@ import type { GraphsResponse } from "@generated/anki/stats_pb"; import * as tr from "@generated/ftl"; import { localizedNumber } from "@tslib/i18n"; -import { dayLabel, timeSpan } from "@tslib/time"; +import { dayLabel, timeSpan, TimespanUnit } from "@tslib/time"; import type { Bin, ScaleSequential } from "d3"; import { area, @@ -141,7 +141,7 @@ export function renderReviews( const yTickFormat = (n: number): string => { if (showTime) { - return timeSpan(n / 1000, true); + return timeSpan(n / 1000, true, false, TimespanUnit.Hours); } else { if (Math.round(n) != n) { return ""; @@ -205,7 +205,7 @@ export function renderReviews( function valueLabel(n: number): string { if (showTime) { - return timeSpan(n / 1000); + return timeSpan(n / 1000, false, true, TimespanUnit.Hours); } else { return tr.statisticsReviews({ reviews: n }); } @@ -340,7 +340,7 @@ export function renderReviews( averageAnswerTime: string, averageAnswerTimeLabel: string; if (showTime) { - totalString = timeSpan(total / 1000, false); + totalString = timeSpan(total / 1000, false, true, TimespanUnit.Hours); averageForDaysStudied = tr.statisticsMinutesPerDay({ count: Math.round(studiedAvg / 1000 / 60), });