From ba9df708f906d005fa2b6b054ef222336185fe01 Mon Sep 17 00:00:00 2001 From: jycouet Date: Thu, 12 Mar 2026 08:01:59 +0100 Subject: [PATCH 1/6] from end --- app/components/Package/TrendsChart.vue | 14 +- app/composables/useCharts.ts | 151 ++++++++++++++----- test/unit/app/composables/use-charts.spec.ts | 112 ++++++++++++-- 3 files changed, 229 insertions(+), 48 deletions(-) diff --git a/app/components/Package/TrendsChart.vue b/app/components/Package/TrendsChart.vue index 7d08014719..05f7762616 100644 --- a/app/components/Package/TrendsChart.vue +++ b/app/components/Package/TrendsChart.vue @@ -402,7 +402,9 @@ const isEndDateOnPeriodEnd = computed(() => { }) const supportsEstimation = computed( - () => displayedGranularity.value !== 'daily' && selectedMetric.value !== 'contributors', + () => + !['daily', 'weekly'].includes(displayedGranularity.value) && + selectedMetric.value !== 'contributors', ) const hasDownloadAnomalies = computed(() => @@ -1081,7 +1083,10 @@ const normalisedDataset = computed(() => { { averageWindow: settings.value.chartFilter.averageWindow, smoothingTau: settings.value.chartFilter.smoothingTau, - predictionPoints: settings.value.chartFilter.predictionPoints ?? DEFAULT_PREDICTION_POINTS, + predictionPoints: + granularity === 'weekly' + ? 0 // weekly buckets are end-aligned → always complete, no prediction needed + : (settings.value.chartFilter.predictionPoints ?? DEFAULT_PREDICTION_POINTS), }, { granularity, lastDateMs, referenceMs, isAbsoluteMetric }, ) @@ -1771,15 +1776,14 @@ watch(selectedMetric, value => {