Repository navigation
fix(home/kpi): format Current Coverage / Target with one decimal - #967
Conversation
|
@coderabbitai review |
|
Warning Review limit reached
More reviews will be available in 27 minutes and 38 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 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
✅ Action performedReview finished.
|
633bf35 to
993afcc
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
When the backend returned a fractional `current_coverage` value, the
dashboard KPI tile rendered the raw float (e.g. `0.14648736342042862%`)
because the template literal `${data.current_coverage || 0}%` did no
formatting. Apply `.toFixed(1)` to both `current_coverage` and
`target_coverage` so the tile reads as e.g. `0.1%` / `80.0%`,
matching the convention already used in inventory.ts.
Regression test in dashboard.test.ts asserts the fractional input
renders as `0.1%` and never as the raw float.
TestHandler_getPurchaseDetails_NotFound_IsClientError set a nonexistent Session.Role field causing go vet to fail: the Session struct carries only UserID/Email; admin is resolved via HasPermissionAPI. Drop the bogus field and confer admin through mockAuth.grantAdmin() so the handler reaches the GetExecutionByID not-found branch it asserts on. Also split multi-statement-per-line entries in handler_purchases_guards_test.go that caused gofmt to fail the pre-commit hook.
e020748 to
92a1f28
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
Summary
The "Current Coverage" KPI tile on the Home page was rendering the raw float when the backend returned a fractional value:
…because
frontend/src/dashboard.ts:271-272interpolated the number with no formatting:Fix
Apply
.toFixed(1)to bothcurrent_coverageandtarget_coverage, matching the convention already used byinventory.ts:357,407andrecommendations.ts:2714.Result: the tile now reads
Current Coverage: 0.1%/Target: 80.0%.Test plan
tsc --noEmitcleandashboard.test.ts: a synthetic summary withcurrent_coverage = 0.14648736342042862renders0.1%, never the raw floatcurrent_coverage(70, 60, 50, 0) keep passing —.toFixed(1)on those produces70.0%etc., backward-compatible since no test asserts on the exact rendered string