Fix Pending review metric collapsing to zero under filters#589
Merged
Fix Pending review metric collapsing to zero under filters#589
Conversation
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.
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_atvsreviewed_at), so under any filter the reviewed cohort routinely overtakes the ingress cohort and the tile clamped to zero. The steward submissionsdaily-metricsendpoint now returns a realpending_reviewcount 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