Skip to content

fix: classify SDG bingo missions correctly instead of daily_challenge (#221) - #233

Open
vedant7007 wants to merge 2 commits into
arzoo0511:mainfrom
vedant7007:fix/sdg-bingo-activitytype-221
Open

fix: classify SDG bingo missions correctly instead of daily_challenge (#221)#233
vedant7007 wants to merge 2 commits into
arzoo0511:mainfrom
vedant7007:fix/sdg-bingo-activitytype-221

Conversation

@vedant7007

Copy link
Copy Markdown
Contributor

Summary

`Bingo.tsx` dispatched every mission tick as a bare `ADD_POINTS` with only a numeric payload. GameContext's reducer at line 589-591 falls back to `'daily_challenge'` when no `activityType` is provided, so all 51 SDG bingo tasks landed in `xp_ledger` with `activity_type = 'daily_challenge'`.

That corrupts:

  • the daily-challenge counter used for stats/streaks (bingo activity inflates it)
  • any per-day cap on daily_challenge (bingo eats into it and starves real daily challenges — or vice versa)
  • badge counts that filter `xp_ledger` by activity type

What changed

  • added `bingo_mission` to the `ActivityType` union in `src/lib/gamification.ts`
  • `Bingo.tsx:373` now dispatches with `activityType: 'bingo_mission'` and `metadata: { goalIndex, taskIndex, sdgTitle }` so the ledger row is queryable and consistent with the pattern used everywhere else in the codebase (`event_participation`, `community_post`, etc.)

Follow-up needed on the backend

The `award_xp_secure` RPC has an activity table on its side. If `bingo_mission` isn't in it, the RPC will either fall back to a default XP calc or reject the activity. Happy to iterate on that in a follow-up once the maintainer flags which behavior applies — the frontend change here is the necessary first step regardless.

Test plan

  • typecheck clean on both files
  • verified the fallback in GameContext:589-591 is the sole cause of misclassification
  • once approved: solve 3 bingo missions, verify 3 new `xp_ledger` rows appear with `activity_type = 'bingo_mission'`, not `'daily_challenge'`

Fixes #221

…_challenge (arzoo0511#221)

Bingo.tsx dispatched every mission tick as a bare `ADD_POINTS` with just
a numeric payload. GameContext's dispatch reducer falls back to
`'daily_challenge'` when no activityType is provided, so every one of the
51 SDG bingo tasks landed in xp_ledger with `activity_type =
'daily_challenge'`. That polluted the daily-challenge counter used for
stats/streaks and could trip a per-day cap on daily_challenge, silently
starving either bingo XP or real daily challenges.

- add `bingo_mission` to the ActivityType union
- Bingo.tsx now dispatches with `activityType: 'bingo_mission'` and
  metadata (goalIndex, taskIndex, sdgTitle) so the ledger row is
  queryable and consistent with the pattern used elsewhere

Note: the backend `award_xp_secure` RPC needs a matching entry for
`bingo_mission` in its activity table. Until then it will either fall
back to a default XP calc or reject the activity; happy to iterate on
that in a follow-up once the maintainer flags either behavior.

Fixes arzoo0511#221
@vercel

vercel Bot commented Jul 11, 2026

Copy link
Copy Markdown

@vedant7007 is attempting to deploy a commit to the arzoorai0207-5745's projects Team on Vercel.

A member of the Team first needs to authorize it.

@vedant7007

Copy link
Copy Markdown
Contributor Author

hey! heads up — the failing Verify Codebase check is red because of a pre-existing issue on master: src/App.tsx:13 imports ./pages/Auth but no Auth file exists in src/pages/. every PR opened right now fails on the same import resolution error (see [Failed to resolve import "./pages/Auth" from "src/App.tsx"] in the run log).

this PR doesn't touch App.tsx or anything in src/pages/, so nothing here is causing it. happy to open a separate PR restoring the Auth page (or wiring the route to whatever the intended replacement is) if you can point me at what should live there. thanks!

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.

[Data-integrity] SDG Bingo missions award XP under wrong activityType — pollutes xp_ledger and inflates daily_challenge counter

1 participant