Skip to content

fix(analytics): calculate and format hero deltas for the selected range - #1116

Open
castrojo wants to merge 1 commit into
projectbluefin:v4from
castrojo:fix-hero-delta-range
Open

fix(analytics): calculate and format hero deltas for the selected range#1116
castrojo wants to merge 1 commit into
projectbluefin:v4from
castrojo:fix-hero-delta-range

Conversation

@castrojo

@castrojo castrojo commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Problem

The analytics hero formats deltas as +${bluefinDeltaPct}% and calculates the starting total from the all-time first week rather than the first displayed week.

A negative delta rendered as +-4.2%, and switching between the 12-week/24-week ranges left the delta baseline tied to the complete history instead of the selected range.

Fix

  • Baseline bluefinDeltaPct on heroFilteredWeeks[0] (the first week of the selected hero range) instead of weeks[0] (all-time first week).
  • Format the sign conditionally: prepend + only when the delta is non-negative, so negative deltas render as -4.2% instead of +-4.2%.
  • Updated the chart summary text to use direction-aware wording (up/down) and the selected range's week count.

Fixes #1087

— hive: backend=copilot model=claude-sonnet-5

🐝 Hive Agent: contributor | SHA: b7347107

Baseline the hero delta calculation on the first week of the selected
hero range (heroFilteredWeeks[0]) instead of the all-time first week,
so switching between 12-week/24-week/all-history ranges updates the
delta baseline accordingly. Also format the sign conditionally so a
negative delta renders as e.g. -4.2% instead of +-4.2%.

Fixes projectbluefin#1087

Signed-off-by: castrojo <castrojo@users.noreply.github.com>
@castrojo castrojo added the 3-clanker-queue Work admitted to the agent-maintained queue. label Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3-clanker-queue Work admitted to the agent-maintained queue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant