mirror of
https://github.com/ankitects/anki.git
synced 2026-01-11 04:53:55 -05:00
merged commits from git
This commit is contained in:
commit
e14c8bf98d
1 changed files with 4 additions and 7 deletions
|
|
@ -109,9 +109,7 @@ export function renderReviews(
|
||||||
}
|
}
|
||||||
const desiredBars = Math.min(70, Math.abs(xMin!));
|
const desiredBars = Math.min(70, Math.abs(xMin!));
|
||||||
const shouldCapRange = range !== GraphRange.AllTime;
|
const shouldCapRange = range !== GraphRange.AllTime;
|
||||||
// Store original xMin before any adjustments (needed for periodDays calculation)
|
const originalXMin = xMin!;
|
||||||
const originalXMinBeforeAdjustment = xMin!;
|
|
||||||
const originalXMin = shouldCapRange ? xMin! : undefined;
|
|
||||||
|
|
||||||
// Create initial scale to determine tick spacing
|
// Create initial scale to determine tick spacing
|
||||||
let x = scaleLinear().domain([xMin!, xMax]);
|
let x = scaleLinear().domain([xMin!, xMax]);
|
||||||
|
|
@ -130,7 +128,7 @@ export function renderReviews(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// For Year, shift thresholds forward by one day to make first bin 0-4 instead of 0-5
|
// For Year, shift thresholds forward by one day to make first bin 0-4 instead of 0-5
|
||||||
if (range === GraphRange.Year) {
|
if (range === GraphRange.Year || range === GraphRange.AllTime) {
|
||||||
thresholds = [...new Set(thresholds.map(t => Math.min(t + 1, 1)))].sort((a, b) => a - b);
|
thresholds = [...new Set(thresholds.map(t => Math.min(t + 1, 1)))].sort((a, b) => a - b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -235,7 +233,7 @@ export function renderReviews(
|
||||||
// For the first (oldest) bin, use the original xMin to ensure labels match the intended range
|
// For the first (oldest) bin, use the original xMin to ensure labels match the intended range
|
||||||
const isFirstBin = bins.length > 0 && d.x0 === bins[0].x0;
|
const isFirstBin = bins.length > 0 && d.x0 === bins[0].x0;
|
||||||
const startDay = isFirstBin
|
const startDay = isFirstBin
|
||||||
? originalXMinBeforeAdjustment
|
? originalXMin
|
||||||
: Math.floor(d.x0!);
|
: Math.floor(d.x0!);
|
||||||
const endDay = d.x1! === 0 ? 1 : d.x1!;
|
const endDay = d.x1! === 0 ? 1 : d.x1!;
|
||||||
const day = dayLabel(startDay, endDay);
|
const day = dayLabel(startDay, endDay);
|
||||||
|
|
@ -356,8 +354,7 @@ export function renderReviews(
|
||||||
// Calculate periodDays from the actual data range, not the adjusted xMin
|
// Calculate periodDays from the actual data range, not the adjusted xMin
|
||||||
// For AllTime, xMin might be extended for bin alignment, so use the original xMin (actual oldest data)
|
// For AllTime, xMin might be extended for bin alignment, so use the original xMin (actual oldest data)
|
||||||
// For fixed ranges, use the original xMin before adjustment (which matches the displayed range)
|
// For fixed ranges, use the original xMin before adjustment (which matches the displayed range)
|
||||||
const actualXMin = originalXMinBeforeAdjustment;
|
const periodDays = -originalXMin + 1;
|
||||||
const periodDays = -actualXMin + 1;
|
|
||||||
const studiedDays = sum(bins, (bin) => bin.length);
|
const studiedDays = sum(bins, (bin) => bin.length);
|
||||||
const studiedPercent = (studiedDays / periodDays) * 100;
|
const studiedPercent = (studiedDays / periodDays) * 100;
|
||||||
const total = yCumMax;
|
const total = yCumMax;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue