Repository navigation
fix: timetable input 500s and the staff submit form on assignments - #47
Conversation
The timetable DTO threw plain Errors, so a missing field on POST /timetable or a bad page number on GET /timetable came back as 500 Internal server error. They now throw BadRequestException with code INVALID_INPUT and the reason, like the other DTOs.
Teachers and admins saw a 'Your Submission' card with a Submit Assignment button on every assignment, but only students can hand in work, so it always failed. Staff now get the details card at full width with the submissions table; students keep their card. The page also stops asking for the submissions list as a student, which the API refuses with 403.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8a40595a3f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } catch { | ||
| // Expected for students | ||
| } | ||
| if (canSeeSubmissions) setSubmissions(await listSubmissions(id)); |
There was a problem hiding this comment.
Keep assignment details visible when submissions loading fails
When a staff user's assignment request succeeds but the separate submissions request fails, this await reaches the outer catch and the page-level error hides the assignment details already loaded. Keep the submissions request failure isolated so staff can still view the assignment when that endpoint has a transient error.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 6238784: the submissions request has its own try/catch now. If it fails, the assignment stays on screen and an error with Retry shows where the table goes. Checked by blocking the request in the browser; Retry then loads the table.
…il to load A failed submissions request reached the page-level catch and replaced the whole page with an error, though the assignment had loaded. It now shows its own error with a retry above where the table goes.
Summary
Fixes from a full QA pass on main (c76c222).
Errors, soPOST /timetablewith a missing field andGET /timetable?page=abcreturned "Internal server error". They now return 400INVALID_INPUTwith the reason, the same as the other DTOs.How it was found
QA ran on a fresh database (all migrations, then the seed, plus two subjects, a room and three classes). The API and a production web build were run locally against it.
Validation
pnpm typecheck,pnpm lint: passBadRequestException.git diff --check: cleanPOST /timetable {}now returns 400 "classId is required";?page=abcreturns 400; a valid list still returns 200.