Skip to content

Fix demo chart data consistency#1390

Merged
riderx merged 1 commit into
mainfrom
riderx/fix-demo-chart-consistency
Jan 8, 2026
Merged

Fix demo chart data consistency#1390
riderx merged 1 commit into
mainfrom
riderx/fix-demo-chart-consistency

Conversation

@riderx
Copy link
Copy Markdown
Member

@riderx riderx commented Jan 8, 2026

Summary

Addresses PR review feedback from #1389 about demo data inconsistency:

  • Fix totals not matching stacked chart: Demo totals are now derived from per-app breakdown by generating per-app data first, then summing to create the total series. This ensures the card stats always match the stacked chart data.

  • Fix array length mismatch with chart labels: Added getDemoDayCount() to determine correct demo data length based on chart mode (30 for last-30-days, or billing period length otherwise).

Test plan

  • View dashboard with no apps or data - demo charts should display
  • Toggle between "Last 30 days" and "Billing period" modes
  • Verify the total value in card header matches the sum of stacked chart segments
  • Check that chart labels align with data points (no truncation/padding)

Checklist

  • My code follows the code style of this project and passes
    bun run lint:backend && bun run lint.
  • My change requires a change to the documentation.
  • I have updated the documentation
    accordingly.
  • My change has adequate E2E test coverage.
  • I have tested my code manually, and I have provided steps how to reproduce
    my tests

Summary by CodeRabbit

Release Notes

  • Refactor
    • Improved consistency of demo data generation across dashboard cards to better align with billing periods and actual data lengths.

✏️ Tip: You can customize this high-level summary in your review settings.

- Add generateConsistentDemoData() to ensure chart totals match stacked per-app data
- Add getDemoDayCount() to match demo data length with chart labels
- Update UsageCard, BundleUploadsCard, DeploymentStatsCard to use consistent demo generation

Addresses PR review feedback about demo totals not matching stacked chart data.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 8, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This pull request introduces unified demo data generation utilities (generateConsistentDemoData and getDemoDayCount) in the demo service, then refactors three dashboard components to use these shared utilities instead of generating demo data independently. The new approach produces consistent, billing-period-aware demo datasets across all components.

Changes

Cohort / File(s) Summary
New Demo Service Utilities
src/services/demoChartData.ts
Added two new exported functions: generateConsistentDemoData (generates per-app and total demo data for two apps) and getDemoDayCount (determines day count based on billing period and existing data length). Existing generateDemoDataByApp marked with deprecation comment.
Dashboard Component Refactoring
src/components/dashboard/BundleUploadsCard.vue, src/components/dashboard/DeploymentStatsCard.vue, src/components/dashboard/UsageCard.vue
Each component now imports and uses the new utility functions to derive a unified consistentDemoData computed value, replacing hardcoded per-component demo data generation. Demo mode logic now switches between real and consistent demo data through effective data properties.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A unified path for demo data flow,
Three cards now sharing, consistent and bright,
No more scattered generators here and there,
One source of truth, oh what a delight!
Billing periods and days aligned with care,
The dashboard dances in demo mode's fair light.

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 87f4d33 and a58b782.

📒 Files selected for processing (4)
  • src/components/dashboard/BundleUploadsCard.vue
  • src/components/dashboard/DeploymentStatsCard.vue
  • src/components/dashboard/UsageCard.vue
  • src/services/demoChartData.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@riderx riderx merged commit 4c8ab50 into main Jan 8, 2026
7 of 9 checks passed
@riderx riderx deleted the riderx/fix-demo-chart-consistency branch January 8, 2026 04:22
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a58b7826f4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 3 to 7
import {
calculateDemoEvolution,
DEMO_APP_NAMES,
generateConsistentDemoData,
generateDemoBandwidthData,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore getDaysInCurrentMonth import used by defaults

The import block no longer brings in getDaysInCurrentMonth, but the data prop default still calls it (default: () => Array.from({ length: getDaysInCurrentMonth() })). This means the symbol is now undefined: TypeScript will flag it, and if data is ever omitted (e.g., during refactors or tests) the component will throw a ReferenceError at runtime. This regression was introduced by removing the import here; either re‑import getDaysInCurrentMonth or change the default to avoid that call.

Useful? React with 👍 / 👎.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jan 8, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
16.7% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

jokabuyasina pushed a commit that referenced this pull request Jan 8, 2026
…1390)

- Add generateConsistentDemoData() to ensure chart totals match stacked per-app data
- Add getDemoDayCount() to match demo data length with chart labels
- Update UsageCard, BundleUploadsCard, DeploymentStatsCard to use consistent demo generation

Addresses PR review feedback about demo totals not matching stacked chart data.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Dalanir pushed a commit that referenced this pull request Jan 12, 2026
…1390)

- Add generateConsistentDemoData() to ensure chart totals match stacked per-app data
- Add getDemoDayCount() to match demo data length with chart labels
- Update UsageCard, BundleUploadsCard, DeploymentStatsCard to use consistent demo generation

Addresses PR review feedback about demo totals not matching stacked chart data.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
jokabuyasina pushed a commit to jokabuyasina/capgo that referenced this pull request Feb 7, 2026
…ap-go#1390)

- Add generateConsistentDemoData() to ensure chart totals match stacked per-app data
- Add getDemoDayCount() to match demo data length with chart labels
- Update UsageCard, BundleUploadsCard, DeploymentStatsCard to use consistent demo generation

Addresses PR review feedback about demo totals not matching stacked chart data.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai coderabbitai Bot mentioned this pull request Feb 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant