Classroom
The teacher workspace, relationship-authorized rosters, grade matrices, and gradebooks over one stream, with admin fallback on reads only.
The classroom module is the teacher-facing surface at /api/v1/classrooms. It reads enrolments and grades. It does not store its own roster. The controller requires a staff token. Most methods have no @RequirePermissions. The teaching row is the check, and some reads also accept a campus-scoped permission.
A grade write is the subject teacher
assertCanGradeStreamSubject passes only when that staff member teaches that subject in that stream. A class teacher who does not teach it, and an admin, both get "You do not teach this subject in this stream". The operation text on the save route says the class teacher can save. The method that runs does not give them that.
| Check | Who passes | Error message |
|---|---|---|
assertStreamReadAccess | Class teacher of the stream, or the fallback permission on the stream’s campus. Subject teachers do not pass. | "You do not have access to this stream" |
assertGradeReadAccess | Class teacher, or the subject teacher, or read on grade for the campus | "You do not teach this subject in this stream" |
assertCanGradeStreamSubject | Subject teacher of that subject in that stream | "You do not teach this subject in this stream" |
A missing staff profile is "Staff profile not found". A missing stream is "Stream not found". The lookup uses the staff profile id, not the user id on the token.
The endpoints
Paths are under /api/v1/classrooms. Queries that name a year or a term take those ids as query fields. The save body is termId, campusAcademicYearId, and a non-empty grades array. Each grade needs enrollmentId, score, and maxScore. grade and remarks are optional strings.
| Method and path | operationId | Who | Result |
|---|---|---|---|
GET me | getMyClassrooms | The caller’s staff profile | 200. Class-teacher streams and subject-by-stream pairs. |
GET staff/:staffId | getStaffClassrooms | Read on staff. Optional campusId. | The same shape for that staff member. |
GET streams/:streamId/roster | listClassroomRoster | Class teacher, or read on enrolment | Every enrolment in that stream and campus year. listRoster does not filter by status. The older comment above it says active students. The query does not. |
GET streams/:streamId/subjects | listClassroomStreamSubjects | Class teacher or list on subject sees every offering. A subject teacher sees only their own. | 200 |
GET streams/:streamId/subjects/:subjectId/grades | getClassroomGrades | Grade read access. termId and campusAcademicYearId are required. | gradeService.getMatrix. Active enrolments in that stream and year, each with firstName, lastName, otherNames, studentNumber (the profile’s studentId), and grade or null. An empty roster returns []. The method comment says this powers the class-teacher grade table. The route still runs assertGradeReadAccess first. |
PUT streams/:streamId/subjects/:subjectId/grades | bulkUpsertClassroomGrades | Subject teacher only. Audited as a grade update. | 200. A subject not offered is "Subject is not offered in this stream". An enrolment outside the year’s roster is "Some enrollments do not belong to this stream for the academic year". |
GET streams/:streamId/gradebook | getClassroomGradebook | Class teacher, or read on grade | Students by subjects, with totals. A missing term is "Term not found". |
GET streams/:streamId/staff | listClassroomStreamStaff | Class teacher, or list on class | Class teacher, which may be null, and subject teachers. |
GET enrollments/:enrollmentId/grades | getEnrollmentGradebook | Staff as above, or a verified guardian after the report is released. The method allows both user types. | 200. No stream is "Enrollment has no stream assignment". A guardian who is not verified gets "You are not a verified guardian of this student". An unreleased report is "Results are not released yet". |
The gradebook total uses Number() on score and maxScore before it adds them. The row it builds has no remarks field. The save body can still send remarks onto the grade. Report-card remarks stay on Reports. The average is the score total divided by the max total, times 100, rounded to two decimal places, or null when the max is 0.
What the Hub shows
The campus classrooms layout will not load unless the route’s beforeLoad allows it. That call passes read on class, staff, and roleNormalized: 'Class Teacher'. What roleNormalized accepts was not opened.
Inside a stream, create on class for that campus opens every stream. Without it, only a stream where you are the class teacher opens. The blocked page is "Stream not available" and "You are not the class teacher of this stream." The heading is the class name plus the stream name, with an O Level or A Level badge and My classroom when you are that class teacher. No assigned teacher reads "No teacher assigned".
The section list is Class Hub, Enrollments, Subjects, Scores, Gradebook, Staff, Exams, and Report Cards. Exams need the CBT flag. Scores and Gradebook need the grading flag. Report Cards need the report-cards flag. This page sets scoresOnly to false, so a class teacher still sees the other sections.
The Scores route requires the grading feature. It lists one card per stream subject. A subject whose id is in myTeachingSubjectIds shows a Can score badge. The card comment says a class teacher oversees every subject and enters none. Choosing a card shows term chips. With a term selected, AssessmentScoreMatrix receives canEnterScores only when the viewing year is unlocked and the caller teaches that subject. No subjects reads "No subjects to score". No term reads "Pick a term".
When canEnterScores is true and the matrix has rows, the component shows Save scores. The click skips columns whose sourceCbtExaminationId is set, skips blank cells, and refuses a value that is not a number with "Invalid scores". An empty batch toasts "Nothing to save" and "Enter at least one score first." A successful useUpsertAssessmentScores toasts "Scores saved" and "Saved" plus the count. Failure toasts "Failed to save scores" and the error message. Cells are read-only when the caller cannot enter scores or the column is linked to a CBT exam. A scale newer than a stored grade shows Recompute, which calls useRecomputeGradebook and toasts "Gradebook recomputed". No assessments reads "No assessments set up". An empty roster reads "No students enrolled in this stream for the selected term." The matrix also loads useClassroomGrades, which is the getMatrix route above, for the Final column. The API grade save on PUT .../grades remains the subject-teacher check. This save writes assessment scores.
getMatrix was read at API 9991a5c7bc43aba704aa484d4b23298e8c4de906. scores.tsx and assessment-score-matrix.tsx were read at Hub c7143aa1e1ee84775012fbd3b05c37023142902b. No score was saved. The earlier classroom access sentences on this page were read at a5dff0c2 and d2d5fe33. Those files are unchanged in the compare to the new pins.