Reports
The report card on report_card, how it moves from draft to approved, when families see it, and who can read it.
A report card is one report_card row per enrollment and term. Every route needs Feature.REPORT_CARDS and starts with /api/v1/report-cards. There is no isPublished, slug or ACADEMIC_REPORT resource; the identifier is reference and the resource is report_card.
The class teacher
| Route | Needs | Does |
|---|---|---|
POST / (createReportCard) | create | The enrollment must be in the chosen year |
POST /bulk (bulkCreateReportCards) | create | Creates missing cards for a stream's active enrollments, carrying custom fields forward |
PATCH /:id (updateReportCard) | update, and be the stream's class teacher | No campus-permission fallback |
POST /:id/regenerate-remarks | update | Rewrites generated remarks; leaves ones a person edited |
POST /:id/submit (submitReportCard) | update | Only from draft or returned |
An enrollment with no stream fails the class-teacher check (You are not the class teacher of this report).
The approver
All three need approve on report_card.
Approve (approveReportCard, only from submitted, year unlocked). Any head-teacher remark is saved first. The card is frozen: layout, slots, school branding and the full content go into snapshot. releasedAt is copied from the term's reportsReleaseAt (or null). The approver and submitter are notified (ACADEMIC_REPORT_APPROVED); guardians only if the release time has already passed.
Or Return (returnReportCard, only from submitted) with a reason. No notification type exists for a return.
Or later Recall (recallReportCard, only from approved, year unlocked). Back to draft, releasedAt cleared.
An enrollment with no school can't be approved, because there's no branding to freeze.
When families see it
Approval doesn't publish: releasedAt is the term's release time, which can be in the future.
The sweep (ReleaseTermReportsSweep) finds terms whose release time has passed, not yet notified, with an unlocked year, and claims each by stamping it. A crash after the claim loses that send; changing the release date re-arms it.
Render PDFs. Each approved, released card is queued on the PDF queue (job report-card-{id}, 3 attempts). Cards missing a snapshot, branding or a known layout are skipped.
Tell families. TERM_REPORTS_RELEASED goes to active students and verified guardians. The link is always /guardian/hub, even for students.
GET /release-progress counts released cards with an up-to-date PDF; POST /requeue-missing re-queues the rest. Both need approve.
Reading a card
GET /, /:id, /:id/content, /:id/preview and /:id/pdf need read. Staff are then narrowed:
| Staff member | Sees |
|---|---|
| Can approve report cards on the campus | Every card |
| Class teacher (not an approver) | Their streams' cards, current year only |
| Neither | Every card their read grant covers |
Students and guardians aren't narrowed this way; their read grant uses releasedAt (see The ability).
Printing is for students, guardians and approvers. Others see the preview with "Printing this report card is restricted to approvers." An approved card is served from its archived PDF when that's current, otherwise re-rendered. A card not yet approved renders a temporary preview.
Layouts and remarks
| Route | Needs | Does |
|---|---|---|
GET /report-card-configs | read on report_card_config | The layout for a year and level, or the platform default (isExplicit: false) |
PUT /report-card-configs | manage on report_card_config | Save it. Year unlocked; assets must be the school's own |
GET /report-card-templates | read on report_card_config | The 20 layouts |
POST /report-card-templates/:layout/preview, /pdf | Same | A sample learner as HTML, or a temporary PDF |
Pip can redraft remarks (not over HTTP) only on draft or returned cards, trimmed to 400 characters, never overwriting remarks a person pinned.