Fix user stat earned status#499
Open
AndiLuo wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes an issue in sqm-big-stat where selecting an “EARNED” reward status in the content editor resulted in the rewards stat not being properly filtered (effectively returning all rewards).
Changes:
- Adjusted
rewardsCountFilteredQueryto apply a fallback reward-status filter when no explicit status is provided. - Applied formatting/Prettier-style updates across
useBigStat.tsx(trailing commas, indentation).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| global = "", | ||
| ) => { | ||
| const statusFilter = status ? { status } : null; | ||
| console.log(statusFilter, "status filter "); |
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (2)
packages/mint-components/src/components/sqm-big-stat/useBigStat.tsx:288
- This changes the meaning of an omitted
statusfrom “no status filtering” to “exclude CANCELLED/EXPIRED” viastatuses_nin. That’s a behavioral change for existing stat formats like/rewardsCountFilteredand/integrationRewardsCountFilteredand isn’t reflected in the documented formats (e.g. CHANGELOG lists the optional:status(...)parameter but doesn’t describe a default exclusion). If the intent is specifically to support anEARNEDpseudo-status, it would be clearer/safer to handle that explicitly rather than changing the default for all calls wherestatusis undefined.
filter: {
programId_eq: $programId
type_eq: $type
unit_eq: $unit
${statusFilter ? "statuses_eq: $statusFilter" : "statuses_nin: [{status: CANCELLED}, {status: EXPIRED}]"}
}
packages/mint-components/src/components/sqm-big-stat/useBigStat.tsx:328
- There are e2e tests for many
sqm-big-statstat-type permutations, but none cover the reportedEARNEDselection. Given the routing/arg-parsing sensitivity here (status vs global segment), please add an e2e case for anEARNEDstat-type and assert it does not fall back to the global query unexpectedly.
gql`
query ($programId: ID, ${statusFilter ? "$statusFilter: RewardStatusFilterInput" : ""}) {
viewer {
... on User {
rewards(
filter: {
programId_eq: $programId
type_eq: INTEGRATION
${statusFilter ? "statuses_eq: $statusFilter" : "statuses_nin: [{status: CANCELLED}, {status: EXPIRED}]"}
}
Comment on lines
265
to
270
| type?: string, | ||
| unit?: string, | ||
| status?: string, | ||
| global = "" | ||
| global = "", | ||
| ) => { | ||
| const statusFilter = status ? { status } : null; |
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.
User stat returning all rewards if selected reward status in content editor is "EARNED"
Type of change
Links
Checklists
Development
Paperwork
Code review