Skip to content

Fix user stat earned status#499

Open
AndiLuo wants to merge 3 commits into
masterfrom
fix-cancelled-bigstat
Open

Fix user stat earned status#499
AndiLuo wants to merge 3 commits into
masterfrom
fix-cancelled-bigstat

Conversation

@AndiLuo
Copy link
Copy Markdown
Contributor

@AndiLuo AndiLuo commented May 22, 2026

User stat returning all rewards if selected reward status in content editor is "EARNED"

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation or Development tools (readme, specs, tests, code formatting)

Links

  • Jira issue number: (PUT IT HERE)
  • Process.st launch checklist: (PUT IT HERE)

Checklists

Development

  • Prettier was run (if applicable)
  • The behaviour changes in the pull request are covered by specs
  • All tests related to the changed code pass in development

Paperwork

  • This pull request has a descriptive title and information useful to a reviewer
  • This pull request has a Jira number
  • This pull request has a Process.st launch checklist

Code review

  • Changes have been reviewed by at least one other engineer
  • Security impacts of this change have been considered

Copilot AI review requested due to automatic review settings May 22, 2026 00:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 rewardsCountFilteredQuery to 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 ");
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 status from “no status filtering” to “exclude CANCELLED/EXPIRED” via statuses_nin. That’s a behavioral change for existing stat formats like /rewardsCountFiltered and /integrationRewardsCountFiltered and 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 an EARNED pseudo-status, it would be clearer/safer to handle that explicitly rather than changing the default for all calls where status is 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-stat stat-type permutations, but none cover the reported EARNED selection. Given the routing/arg-parsing sensitivity here (status vs global segment), please add an e2e case for an EARNED stat-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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants