Skip to content

fix: timetable input 500s and the staff submit form on assignments - #47

Merged
anishmehta24 merged 3 commits into
mainfrom
fix/timetable-input-errors
Nov 18, 2026
Merged

anishmehta24 merged 3 commits into
mainfrom
fix/timetable-input-errors

Conversation

@anishmehta24

Copy link
Copy Markdown
Collaborator

Summary

Fixes from a full QA pass on main (c76c222).

  • Timetable input errors were 500s. The timetable DTO threw plain Errors, so POST /timetable with a missing field and GET /timetable?page=abc returned "Internal server error". They now return 400 INVALID_INPUT with the reason, the same as the other DTOs.
  • Staff saw a submit form they can't use. On an assignment page, teachers and admins got a "Your Submission" card with a Submit Assignment button. Handing in work is student-only, so the button always failed. Now only students see that card. Staff get the details card at full width, with the submissions table under it.
  • No more 403 on a student's assignment page. The page asked every user for the full submissions list and ignored the 403 a student got back. It now asks only for staff.

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.

  • API script (204 checks): every role and every main flow. That covers sign-in, settings, people and HOD changes, timetable clashes, targeted announcements, attendance and corrections, assignments and grading, exams through publishing, fees with test-mode payment and replay protection, tasks with rework, visitors, files, notifications, analytics, account lockout and logout, and the role restrictions. The timetable 500s were the only failures from the app.
  • Browser crawl: headless Chrome signed in through the login form as admin, both HODs, faculty and student, and opened 99 pages. Student pages were also checked at phone width. The crawl watched for crashes, console errors, failed requests, error text and overflow. The only finding was the 403 on the student assignment page.
  • Form flows: 19 real form submissions in the browser. They include adding faculty and students, creating an exam, timetable slot, fee structure, invoice, announcement and visitor, and saving settings. Also: an HOD task from creation through assign, start, submit and approve; attendance, an assignment and a student hand-in; a test-mode fee payment; and a profile edit. All pass.
  • Realtime: task and notification events reach the right people live and don't reach other departments.

Validation

  • pnpm typecheck, pnpm lint: pass
  • API tests: 379 pass. The new test checks that bad create bodies and list queries throw BadRequestException.
  • git diff --check: clean
  • Checked live on the branch:
    • POST /timetable {} now returns 400 "classId is required"; ?page=abc returns 400; a valid list still returns 200.
    • The faculty assignment page shows details and the submissions table, with no submit card.
    • The student page shows their submission and grade, with no 403.
    • A student hand-in still returns 201.

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.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T15:16:10.644700Z 8a40595 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
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