Grading operations
Assessment, score, config, and template routes, including who is allowed to call each one.
Prefix every path with /api/v1. All four controllers require Feature.GRADING and user type staff. Assessment and score routes do not use @RequirePermissions. Their class comments say the service checks a teaching relationship (SubjectXTeacher) instead. Config and template routes do use grading_config permissions. None of these handlers were called. The compute rules are on Grading.
What a teacher does
GET /grading/scores/matrix?subjectId&termId&streamId(getAssessmentScoreMatrix) loads the grid. All three query names are required. The text says one row per active enrollment andnullwhere a score is missing.PUT /grading/scores(upsertAssessmentScores) writes the grid. Body isUpsertAssessmentScoresDto(subjectId,termId,streamId,rows). The text says each score must sit in[0, maxScore], eachassessmentIdmust belong to that subject and term, and the enrollment is checked against the real stream rather than the request alone. The response decorator is 200 with no body type. The handler returns the service result, which the comment says is void.POST /grading/scores/recompute(recomputeGradebook, 201{ "message": "Gradebook recomputed" }) rebuilds grades for that subject, term, and stream after a config change. The text says it is idempotent and uses the same teaching check.
Linking a CBT exam is separate: POST /grading/assessments/:id/link-cbt-exam with body LinkCbtExamDto (examinationId is the field the handler reads). The text says the exam must share the assessment’s subject and term, must be assigned to a stream, and must not already be linked elsewhere. DELETE /grading/assessments/:id/link-cbt-exam removes the link and the text says existing scores stay editable.
Assessments
Controller AssessmentController, prefix grading/assessments. The class comment says this controller no longer creates assessments. Definitions come from the grading config, and the first list materialises rows.
| Method and path | operationId | Auth beyond staff + feature | Result the decorator names |
|---|---|---|---|
GET / | listAssessments | Teaching relationship, asserted in the service | 200 array of AssessmentDto. Query ListAssessmentsQueryDto |
POST /:id/link-cbt-exam | linkCbtExamToAssessment | Same | 200 AssessmentDto. 404 “Assessment or examination not found.” |
DELETE /:id/link-cbt-exam | unlinkCbtExamFromAssessment | Same | 200. 404 “Assessment not found.” |
Scores
Controller AssessmentScoreController, prefix grading/scores.
| Method and path | operationId | Error copy on the decorator |
|---|---|---|
GET /matrix | getAssessmentScoreMatrix | Auth failures from the service were not copied |
PUT / | upsertAssessmentScores | 400 “Unknown assessmentId, score out of range, or enrollment not in stream.” |
POST /recompute | recomputeGradebook | 400 “Invalid subject, term, or stream id.” |
Configs
Controller GradingConfigController, prefix grading/configs.
| Method and path | operationId | Permission | Result |
|---|---|---|---|
POST / | createGradingConfig | create grading_config | 201 GradingConfigDto. The text says bands must tile 0–100, group weights sum to 100, and one config exists per campus year and level |
POST /default | createDefaultGradingConfig | create grading_config | 201. The text says this seeds a Ugandan O-level config and fails if one already exists |
GET / | listGradingConfigs | list grading_config | 200. Optional query campusId. The handler also reads CurrentUser('campusId') and passes that value to list |
GET /:id | getGradingConfig | read grading_config | 200. 404 “Grading config not found.” |
PATCH /:id | updateGradingConfig | update grading_config | 200. The text says supplying bands replaces the set, and groups reconcile by id |
POST /:id/recompute | recomputeGradingConfig | update grading_config | 201 { "message": "Recompute complete" } |
DELETE /:id | deleteGradingConfig | delete grading_config | 200 { "message": "Grading config deleted successfully" } |
GET /grading/templates is GradingTemplatesController.list, operation id listGradingTemplates. It requires create on grading_config and returns the built-in templates. There is no write route on that controller.
Teaching checks
GradingAccessService resolves the JWT user id to a staff profile and throws Staff profile not found when there is none. The comment says a check that skipped this step would compare a user id with a staff-profile id and fail every time. There is no CASL fallback on these writes.
| Call | Who passes | Exception |
|---|---|---|
assertTeachesSubject | Any SubjectXTeacher row for the subject | You do not teach this subject |
assertCanViewStream | Teaches that subject in that stream, or is class teacher of the stream | You do not teach this subject in this stream |
assertCanGradeStream | Teaches that subject in that stream. A class teacher does not pass | Same sentence |
assertCanEnterScore | Loads the enrollment. Missing enrollment is Enrollment not found. No streamId is Enrollment has no stream assignment. Otherwise assertCanGradeStream using the enrollment’s stream, not a stream id from the request | As above |
assertIsClassTeacherOfStream | A ClassXTeacher row for that stream | You are not the class teacher of this stream |
The class comments on the controllers say the service asserts these. This pass did not re-read each assessment and score method to name which of the five it calls. The exception strings are the ones those methods throw when they are called.
Sources
Naalya-API a5dff0c208d5193c274d3d1f87787b55344d5d30: assessment.controller.ts, assessment-score.controller.ts, grading-config.controller.ts, grading-templates.controller.ts, grading-access.service.ts. No handler was called.
Grading engine
The competency grading system, a pure compute engine over per-level config, with banded results and write-through to the gradebook.
Assessments and scores
Per-stream assessments with a group weight budget, the lazy score-entry matrix, and the guarded upsert that feeds the compute engine.