Skip to content

Dashboard comparison mode uses incorrect date window calculation #270

Description

@usmanimamu17-create

The SLA dashboard view (src/components/dashboard/sla-dashboard-view.tsx) implements a comparison mode that fetches metrics for a previous period. The comparisonFilters calculation uses filters.date_from as the end date and subtracts 30 days to compute the start date. However, when filters.date_from is not set, it defaults to Date.now(), which may not align with the user's intended comparison window. The calculation does not account for filters.date_to.

Root cause: Lines 65-75 in src/components/dashboard/sla-dashboard-view.tsx - Fixed 30-day period logic ignores actual filter range.

Why this is architecturally hard

  1. Comparison window logic assumes fixed 30-day period, but primary filter range may be different
  2. filters.date_to is ignored in comparison calculation
  3. Backend API expects valid ISO dates; improper calculation can result in date_to before date_from

Acceptance criteria

  • Comparison window duration matches primary window duration
  • Setting both date_from and date_to produces comparison window of same length, shifted backward
  • Comparison is disabled when no date range selected

Getting started

Files: src/components/dashboard/sla-dashboard-view.tsx

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third CampaignbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions