Skip to content

Calculate weekly campaign KPI changes from comparable weeks - #90

Merged
obsessixnv merged 3 commits into
mainfrom
fix/55-weekly-kpi-deltas
Sep 15, 2026
Merged

obsessixnv merged 3 commits into
mainfrom
fix/55-weekly-kpi-deltas

Conversation

@obsessixnv

Copy link
Copy Markdown
Contributor

What

Weekly channel KPI deltas were always an em dash. They now compare each complete Monday–Sunday bucket with the preceding calendar week in the loaded, filtered history, using the same KPI definition as cards and tables.

Direction follows each channel's lowerIsBetter setting. Partial weeks, missing observations, unavailable or zero baselines, and the Total row remain unavailable. An observed zero-denominator day does not suppress an otherwise valid weekly ratio. Weekly CSV uses the same calculation records, including KPI values and fractional changes, so it reconciles to the table.

Closes #55.

Validation

  • Fourteen focused campaign browser tests passed after rebasing onto the prior dashboard fixes. The new two-channel fixture checks CPC 10→4 (-60%, favorable lower), CTR 1%→2% (+100%, favorable higher), CSV values, first/missing/zero/partial weeks and blank Total-row deltas. The observed-zero-day case also checks matching weekly HTML and CSV comparisons.
  • Unit tests and mandatory integration passed before opening.
  • Complete browser, dependency and shell checks run in CI.

Existing pages receive the corrected comparisons after template sync and an explicitly reviewed rerender onto the new immutable revision.

Checklist

  • npm test passes
  • npm run test:browser and bash test/run-integration.sh pass, or the PR says why they were not run
  • Nothing renders agent HTML on the dashboard origin; allow-same-origin never joins allow-scripts
  • Docs updated where behaviour changed
  • New source files carry the SPDX header (none added)
  • No secrets, real customer data, or internal hostnames in the diff

Screenshots

Browser regressions verify the weekly values, delta text, direction colors and corresponding CSV cells.

@obsessixnv obsessixnv added bug Something isn't working priority:P2 Normal: correctness, reliability, or supported-workflow failure. size:S Small: roughly up to 1 engineering day including focused checks. area:dashboard Pages dashboard functionality and maintenance. audit:2026-09-14 Functional and reliability audit of commit 420bad8; cybersecurity excluded. labels Sep 15, 2026
@obsessixnv
obsessixnv merged commit a19f9a5 into main Sep 15, 2026
5 checks passed
@obsessixnv
obsessixnv deleted the fix/55-weekly-kpi-deltas branch September 15, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:dashboard Pages dashboard functionality and maintenance. audit:2026-09-14 Functional and reliability audit of commit 420bad8; cybersecurity excluded. bug Something isn't working priority:P2 Normal: correctness, reliability, or supported-workflow failure. size:S Small: roughly up to 1 engineering day including focused checks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P2] Weekly KPI change columns are permanently filled with placeholders

1 participant