Skip to content

fix(home/stats): drop /mo suffix from Period Savings total (revert #763 auto-fix) - #767

Merged
cristim merged 3 commits into
feat/multicloud-web-frontendfrom
fix/period-savings-mo-suffix
May 27, 2026
Merged

fix(home/stats): drop /mo suffix from Period Savings total (revert #763 auto-fix)#767
cristim merged 3 commits into
feat/multicloud-web-frontendfrom
fix/period-savings-mo-suffix

Conversation

@cristim

@cristim cristim commented May 27, 2026

Copy link
Copy Markdown
Member

Problem

PR #763 ("CodeRabbit auto-fixes") appended ' ' + suffix (e.g. /mo) to
periodSavingsEl.textContent. That is semantically wrong: Period Savings
is a cumulative dollar total over the selected date range, not a per-unit
rate.
Displaying $500.00 /mo implies a monthly rate, not a total.
Four tests failed as a result.

Update: moved unit indicator below the value for cleaner semantic separation.

Fix

Move the unit indicator from the label to a small sub-line below the value:

  • Label stays plain: Period Savings
  • Value stays clean: $500.00
  • New sub-line (#period-savings-unit): shown in monthly equivalents / shown in hourly equivalents / shown in yearly equivalents

This separates the three concerns cleanly: label = what, value = number,
sub-line = how it is displayed. The sub-line uses the new .stat-unit-context
CSS class (small, muted text) consistent with the project's --cudly-text-muted
token already used throughout stat cards.

Changes

  • frontend/src/index.html: added <p class="stat-unit-context" id="period-savings-unit">shown in monthly equivalents</p> below #period-savings. Restored #period-savings-label to plain Period Savings.
  • frontend/src/modules/savings-history.ts: in renderSavingsStats,
    set #period-savings-label to the constant 'Period Savings' and drive
    #period-savings-unit with shown in ${adjective.toLowerCase()} equivalents.
    Updated inline comment to reflect new "below the value" placement.
  • frontend/src/styles/charts.css: added .stat-unit-context rule
    (font-size: 0.85rem, color: var(--cudly-text-muted), margin-top: 0.25rem).
  • frontend/src/__tests__/savings-history.test.ts: added
    <p id="period-savings-unit"> to the DOM fixture; updated the three
    unit-toggle assertions to query #period-savings-unit instead of
    #period-savings-label.

Tests

79 tests pass. The originally-failing value assertions (toBe('$500.00') etc.)
are unchanged.

Revert the change applied by PR #763 ("CodeRabbit auto-fixes"): it appended
the unit suffix to Period Savings even though the line immediately above
explicitly says Period Savings is a cumulative dollar total over the
selected date range, NOT a per-unit rate.

The auto-fix violated its own comment and broke 4 tests in
frontend/src/__tests__/savings-history.test.ts, which assert plain
"$X.XX" output (no suffix). Restoring the original behaviour so the
tests and the comment agree again.
@cristim cristim added priority/p1 Next up; this sprint severity/high Significant harm urgency/now Drop other things impact/all-users Affects every user bug Something isn't working triaged Item has been triaged labels May 27, 2026
@cristim

cristim commented May 27, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@cristim, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 8 minutes and 11 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9e36f45e-9932-460f-98a2-c9797b23a0e2

📥 Commits

Reviewing files that changed from the base of the PR and between b5d3d00 and c358714.

📒 Files selected for processing (4)
  • frontend/src/__tests__/savings-history.test.ts
  • frontend/src/index.html
  • frontend/src/modules/savings-history.ts
  • frontend/src/styles/charts.css
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/period-savings-mo-suffix

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Period Savings is a cumulative dollar total over the selected date range,
not a per-unit rate. Appending /mo, /hr, or /yr to the value misrepresents
it as a rate. Instead, the label becomes "Period Savings (monthly)" etc.,
reinforcing which view mode is active without implying a rate.

Added id="period-savings-label" to the <h4> in index.html, updated
renderSavingsStats to set its textContent to `Period Savings (${unit})`
using the already-available adjective variable (lowercased), and added
label assertions to the unit-toggle test for all three units.
@cristim

cristim commented May 27, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

The label ("Period Savings") answers "what is this number" and should
stay plain across all unit modes. A new sub-line element
(#period-savings-unit, class stat-unit-context) below the dollar value
carries the view-mode context ("shown in monthly/hourly/yearly
equivalents"), making the semantic layering explicit: label = what,
value = number, sub-line = how it is displayed. Updated the DOM fixture
and three unit-toggle assertions in savings-history.test.ts to query
#period-savings-unit. Added .stat-unit-context CSS rule to charts.css.
@cristim

cristim commented May 27, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim
cristim merged commit 6d20076 into feat/multicloud-web-frontend May 27, 2026
5 checks passed
@cristim
cristim deleted the fix/period-savings-mo-suffix branch May 27, 2026 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working impact/all-users Affects every user priority/p1 Next up; this sprint severity/high Significant harm triaged Item has been triaged urgency/now Drop other things

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant