Skip to content

Fix Pending review metric collapsing to zero under filters#589

Merged
JoaquinBN merged 2 commits intodevfrom
JoaquinBN/fix-pending-review
May 2, 2026
Merged

Fix Pending review metric collapsing to zero under filters#589
JoaquinBN merged 2 commits intodevfrom
JoaquinBN/fix-pending-review

Conversation

@JoaquinBN
Copy link
Copy Markdown
Collaborator

Summary

The Metrics dashboard Pending review tile dropped to zero whenever a category, contribution-type, or date-range filter was applied. It was derived in the frontend as ingress - reviewed, but those totals are bucketed on different timestamps (created_at vs reviewed_at), so under any filter the reviewed cohort routinely overtakes the ingress cohort and the tile clamped to zero. The steward submissions daily-metrics endpoint now returns a real pending_review count of submissions created in the selected range that are still in the pending state, respecting the active category and type filters, and the dashboard reads it directly. Tile subtitle updated to describe the new semantics.

Test plan

  • Open Metrics → Portal tab and confirm the Pending review tile shows a sensible value with no filters
  • Apply a category filter (e.g. Builder) and confirm the count updates without going to zero
  • Apply a contribution-type filter and confirm the count updates
  • Narrow the date range to a recent week and confirm the count reflects only submissions created in that window that are still pending

JoaquinBN added 2 commits May 2, 2026 21:12
The Pending review tile on the Metrics dashboard was derived in the
frontend as ingress minus reviewed, but those two totals are bucketed
on different timestamps (created_at vs reviewed_at). Under any
category, type, or date-range filter the reviewed cohort routinely
exceeds the ingress cohort and the value clamped to zero. The steward
submissions daily-metrics endpoint now returns a real pending count
(submissions created in the selected range that are still in pending
state, respecting the category and contribution_type filters) and the
dashboard reads it directly, so the tile tracks the rest of the page
coherently as filters change.

## Claude Implementation Notes
- backend/contributions/views.py: Add pending_review to the daily-metrics totals, computed from base_qs filtered by state='pending' and the start/end date window so the count reflects current pending submissions created in the range with the active category/type filters applied.
- frontend/src/routes/Metrics.svelte: Replace the broken Math.max(0, ingress - reviewed) derivation with totals.pending_review from the API, and update the tile subtitle to describe the new semantics.
@JoaquinBN JoaquinBN merged commit 1083eca into dev May 2, 2026
@JoaquinBN JoaquinBN deleted the JoaquinBN/fix-pending-review branch May 2, 2026 23:42
@saminutaska saminutaska mentioned this pull request May 3, 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