[MEDIUM] Combine DashboardStats 3-pass reductions into a single loop #41

Closed
opened 2026-06-09 00:03:13 +00:00 by Mark · 0 comments
Owner

Location: backend/src/services/DashboardService.ts

Problem: totalMonthly, autoPayTotal, and trialCount each run separate .reduce() / .filter().reduce() passes over the same subscriptions array.

Impact: Traverses the same array 3 times instead of 1.

Fix: Merge into a single .reduce() that accumulates all stats in one pass.

Effort: ~30 mins

**Location:** `backend/src/services/DashboardService.ts` **Problem:** `totalMonthly`, `autoPayTotal`, and `trialCount` each run separate `.reduce()` / `.filter().reduce()` passes over the same subscriptions array. **Impact:** Traverses the same array 3 times instead of 1. **Fix:** Merge into a single `.reduce()` that accumulates all stats in one pass. **Effort:** ~30 mins
Mark 2026-06-09 00:03:13 +00:00
  • closed this issue
  • added the
    bug
    label
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/subvault#41
No description provided.