Skip to content

Let admins and coaches adjust a student's points - #84

Draft
VidsterBroyo wants to merge 1 commit into
feat/rewards-redeemfrom
feat/points-adjustments
Draft

VidsterBroyo wants to merge 1 commit into
feat/rewards-redeemfrom
feat/points-adjustments

Conversation

@VidsterBroyo

@VidsterBroyo VidsterBroyo commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

Notion ticket link

Ticket

Stack 3 of 4: ad-hoc adjustments. Builds on #83.

Implementation description

  • adjustStudentPoints(studentId, amount, note) for admins and coaches.
    • It writes an ADJUSTMENT row to points_transactions and updates Student.points under the same student-row lock as redemptions and feedback sends.
    • amount must be a non-zero integer. note is optional, at most 500 characters, and whitespace-only becomes null.
  • It returns the ledger row and the student with the new balance.
  • This is also how staff undo a redemption: add the points back with a note.

What should reviewers focus on?

  • Balances can go negative. A coach taking back points a student already spent leaves a negative balance. Editing sent feedback can already do this, so I didn't block it. Should we?
  • Volunteers can't adjust. Only admins and coaches can.
  • Tested live: permissions, validation, negative balances, and that a full seed reverses adjustments.

Checklist

  • My PR name is descriptive and in imperative tense
  • My commit messages are descriptive and in imperative tense. My commits are atomic and trivial commits are squashed or fixup'd into non-trivial commits
  • I have run the appropriate linter(s)
  • I have requested a review from the TL, as well as other devs who have background knowledge on this PR or who will be building on top of this PR

🤖 Generated with Claude Code

adjustStudentPoints records an ADJUSTMENT in points_transactions with an
optional note and updates Student.points under the same student-row lock as
redemptions and feedback sends. Adjustments can take a balance below 0, the
same way editing sent feedback already can.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@VidsterBroyo
VidsterBroyo added this pull request to stack #86 November 30, 2026 02:59
@VidsterBroyo VidsterBroyo changed the title feat: let admins and coaches adjust a student's points Let admins and coaches adjust a student's points Nov 30, 2026
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.

1 participant