Skip to content

courses: course-scoped exam grading and submission management (fixes #10259) - #10260

Open
RyanS4 wants to merge 5 commits into
masterfrom
10259-scope-submissions-courses
Open

courses: course-scoped exam grading and submission management (fixes #10259)#10260
RyanS4 wants to merge 5 commits into
masterfrom
10259-scope-submissions-courses

Conversation

@RyanS4

@RyanS4 RyanS4 commented Aug 11, 2026

Copy link
Copy Markdown
Member

Fixes #10259

Summary

Addresses discussion from #10255 by introducing a dedicated course-scoped exam grading and submission management page (/courses/submissions/:id) for Course Managers.

Key Features & Implementation

  • Dedicated Course Submissions Route (/courses/submissions/:id):
    • Introduces CoursesSubmissionsComponent (src/app/courses/submissions-courses/) providing Course Managers with a dedicated space to view and grade exam submissions scoped strictly to a specific course.
  • Embedded Submissions Container (SubmissionsComponent):
    • Reuses <planet-submissions [courseId]="courseId" [hideHeader]="true"> to provide full submission table sorting, pagination, and status filtering without duplicating code.
    • Added @Input() courseId to SubmissionsComponent to filter Mango queries by course ID suffix (@${escapedCourseId}$).
    • Added @Input() hideHeader to suppress duplicate toolbar headers and redundant back navigation buttons when embedded.
  • Course Action Entry Points:
    • Added a "Submissions & Grading" menu option in CoursesComponent and toolbar action button in CoursesViewComponent for authorized course managers (canManage === true).
  • Submission-Aware Exam View Fixes:
    • Updated ExamsViewComponent.setExam() to prioritize submissionId initialization over courseId, eliminating infinite loading loops when opening a submission.
    • Updated setCourseListener() to skip step availability checks when viewing a specific submission, preventing false "This test is not available" alerts.
  • Defensive Query Matching:
    • Escaped regex metacharacters in courseId and anchored patterns to @courseId$ to guarantee exact course ID matching without substring collisions.

Verification

  • Unit test suite added in courses-submissions.component.spec.ts (100% passing).
  • npm run lint passed with 0 errors.
image {4B3554B9-3D1F-407E-9FD6-43DEC559AA8F}

@RyanS4
RyanS4 marked this pull request as ready for review August 11, 2026 18:25
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: QUIET

Plan: Pro Plus

Run ID: 8eca5b9d-51b3-4723-89bf-e4461195e267

📥 Commits

Reviewing files that changed from the base of the PR and between 7cb379b and 27bf7a2.

📒 Files selected for processing (1)
  • src/app/submissions/submissions.component.ts

📝 Walkthrough

Walkthrough

Adds manager-only course submissions and grading routes. Reuses SubmissionsComponent with course filtering and course context. Updates exam initialization for submission routes and adds component tests.

Changes

Course-scoped grading

Layer / File(s) Summary
Course grading entry and container
src/app/courses/...
Adds course grading routes, manager-only links, and CoursesSubmissionsComponent with loading, authorization, course updates, back navigation, styling, and tests.
Course context in submissions
src/app/submissions/...
Adds course inputs, filtered queries, title rendering, status filters, hidden-header handling, and back-click output.
Submission-aware exam initialization
src/app/exams/exams-view.component.ts
Prioritizes submission initialization and skips course updates for submission-based views.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: mutugiii

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes provide Course Managers with course-scoped submission access, filtering, grading navigation, and submission-specific exam handling required by #10259.
Out of Scope Changes check ✅ Passed The routes, UI actions, reusable submission updates, exam handling, styles, and tests directly support the linked course-scoped grading objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: course-scoped exam grading and submission management.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Actionable comments posted: 3

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

🟡 Other comments (1)
src/app/submissions/submissions.component.html-56-67 (1)

56-67: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Render the new filter template explicitly.

The toolbar outlets resolve the root-level #filterDropdown at line 43. The second #filterDropdown is scoped to the @if block and does not replace it. The Active/Inactive filter does not render.

Use a distinct template reference and select it conditionally, or replace the original template.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/app/submissions/submissions.component.html` around lines 56 - 67, Update
the submissions toolbar template so the Active/Inactive filter defined in the
`@if` block is actually rendered instead of being shadowed by the root-level
`#filterDropdown`. Give the conditional template a distinct reference and update
the toolbar outlet selection to use it when filter.type is not 'survey', while
preserving the existing filter for survey submissions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/app/courses/courses-router.module.ts`:
- Line 28: Add the existing course-manager authorization guard to the route
definition for submissions/:id in the router configuration, while preserving the
current component mapping and server-side authorization. Use the same guard
configuration pattern already used by neighboring protected course routes.

In `@src/app/courses/submissions-courses/courses-submissions.component.html`:
- Around line 1-3: Update the page-level loading spinner condition in the
template to use the required *ngIf="isLoading" directive instead of the `@if`
block, while preserving the translated “Loading submissions...” text on
planet-loading-spinner.

In `@src/app/submissions/submissions.component.ts`:
- Around line 217-219: Update the selector construction in the submissions
component’s courseId branch to escape all regex metacharacters in the route
value, then anchor the escaped value so the course ID matches the intended
course suffix exactly rather than arbitrary substrings or patterns. Preserve the
existing findDocuments and parentId query structure.

---

Other comments:
In `@src/app/submissions/submissions.component.html`:
- Around line 56-67: Update the submissions toolbar template so the
Active/Inactive filter defined in the `@if` block is actually rendered instead of
being shadowed by the root-level `#filterDropdown`. Give the conditional template
a distinct reference and update the toolbar outlet selection to use it when
filter.type is not 'survey', while preserving the existing filter for survey
submissions.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: QUIET

Plan: Pro Plus

Run ID: 4220868a-23f5-4cb5-ac1c-b59f3b9b4eae

📥 Commits

Reviewing files that changed from the base of the PR and between 6c3ea09 and 7cb379b.

📒 Files selected for processing (11)
  • src/app/courses/courses-router.module.ts
  • src/app/courses/courses.component.html
  • src/app/courses/courses.module.ts
  • src/app/courses/submissions-courses/courses-submissions.component.html
  • src/app/courses/submissions-courses/courses-submissions.component.scss
  • src/app/courses/submissions-courses/courses-submissions.component.spec.ts
  • src/app/courses/submissions-courses/courses-submissions.component.ts
  • src/app/courses/view-courses/courses-view.component.html
  • src/app/exams/exams-view.component.ts
  • src/app/submissions/submissions.component.html
  • src/app/submissions/submissions.component.ts

Comment thread src/app/courses/courses-router.module.ts
Comment thread src/app/submissions/submissions.component.ts
@RyanS4
RyanS4 marked this pull request as draft August 11, 2026 18:33
@RyanS4
RyanS4 marked this pull request as ready for review August 11, 2026 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Courses: Integrated Course-Scoped Grading

1 participant