Skip to content

feat(scoring): accrue server-side for the ~85 checked quiz modules (#91) - #400

Open
lucky-pluton wants to merge 1 commit into
vicharanashala:mainfrom
lucky-pluton:fix/91-accrue-quiz-scores-server-side
Open

lucky-pluton wants to merge 1 commit into
vicharanashala:mainfrom
lucky-pluton:fix/91-accrue-quiz-scores-server-side

Conversation

@lucky-pluton

Copy link
Copy Markdown
Contributor

Closes #91 — Part of the #87 scoring-ledger epic.

TL;DR

Quiz coins and solved counts were previously computed in the client browser and trusted by the server. This PR wires the atomic
ecordEvent()\ ledger writer into the global \POST /-api/check\ middleware choke point so that coins, XP, and totalSolved accrue authoritatively on the server across all ~85 quiz modules.

Changes

  • Update the global \POST /-api/check\ middleware in \server/index.js\ to invoke
    ecordEvent\ for logged-in users on verified check responses.
  • Attach updated totals (\coins, \xp, \ otalSolved, \coinsEarned, \xpEarned) to the response object.
  • Add \server/tests/quizAccrual.test.js: integration tests confirming that quiz check endpoints trigger
    ecordEvent\ and return updated totals.

Verification


  • pm test\ in \server/: 193/193 tests passed.

  • px vitest run tests/quizAccrual.test.js: 2/2 tests passed.

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

✅ Parikshak — all automated checks pass

This is Parikshak, an automated, comment-only check — it never closes or approves a PR. A human reviewer still makes the final call. See CONTRIBUTING.md for the full contribution rules.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scoring: accrue server-side for the ~85 checked quiz modules

1 participant