Skip to content

Improve Request#Show page for instructors with review information - #455

Open
cycomachead wants to merge 3 commits into
mainfrom
cycomachead/151-improve-request-show-instructor/1
Open

Improve Request#Show page for instructors with review information#455
cycomachead wants to merge 3 commits into
mainfrom
cycomachead/151-improve-request-show-instructor/1

Conversation

@cycomachead

Copy link
Copy Markdown
Contributor

Improve Request#Show Page for Instructors with Review Information

Surfaces the context an instructor needs to make an informed approval/denial decision on an extension request, and cleans up the underlying role-checking pattern across the app.

Changes

New instructor review context on Request#Show:

  • Student email (mailto link) and an "Extended requests allowed" badge
  • Request submission timestamp with a before/after-deadline badge
  • Direct LMS link to the assignment
  • Projected late due date that will be applied on approval (for pending requests)
  • Student's full extension history in the course (assignment, requested date, days, submission date, status) in a compact table with approved/pending/denied summary counts
  • Decision provenance for already-decided requests (who processed it and when)

RequestReviewPresenter (app/presenters/request_review_presenter.rb) — encapsulates all the review-context data computation (student history, status counts, enrollment, projected dates) so the controller stays thin and the view reads from a single @review object.

_student_extension_history partial — the history table extracted into its own partial for clarity.

staff_user? helper — replaces every @role == 'instructor' permission check across controllers and views with a semantic, memoized predicate that delegates to Course#course_staff?. Available in both controllers and views via helper_method.

Security fix in AssignmentsController#toggle_enabled — previously trusted a client-supplied role param to determine authorization. Now uses the server-side staff_user? check exclusively.

Testing

  • Added spec/presenters/request_review_presenter_spec.rb (8 examples) covering all presenter methods including edge cases (no enrollment, submitted after deadline, status counts excluding current request).
  • Added controller specs for the instructor show action asserting template rendering and correct @review presenter assignment.
  • Added a regression test asserting AssignmentsController ignores a client-supplied role: 'instructor' param.
  • Added #staff_user? specs covering staff-true, student-false, nil guards, and memoization correctness.
  • Fixed a latent test isolation bug: the users factory generated bare numeric canvas_uid sequences ("1", "2", …) that would eventually collide with hardcoded UIDs in specs. Prefixed the sequence ("canvas-uid-#{n}") to prevent collisions across full suite runs.
  • Fixed course_settings_controller_spec enrollments that used a fictitious role: 'instructor' (not a real DB role); switched to role: 'teacher'.

Full suite: 446 examples, 0 failures.

Documentation

No additional documentation required.

Checklist

  • Name of branch corresponds to story

Superconductor Ticket Implementation | App Preview | Guided Review

@cycomachead

Copy link
Copy Markdown
Contributor Author

This is good. Will merge after we add student notes and display those.

@cycomachead cycomachead mentioned this pull request Jul 2, 2026
20 tasks
@cycomachead

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

Copilot AI commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved in 5262d4e. The merge brought in all changes from origin/main (including the Enrollment rename, student notes feature, security audit changes, and more) and resolved 12 conflicted files:

  • Controllers: Kept staff_user? helper while adopting main's require_course_staff! name; used @assignment.course from main; removed redundant inline auth guards now covered by before_action
  • instructor_show view: Combined both our extension history/provenance section and main's student notes section — both features are now present
  • Presenter: Updated UserToCourseEnrollment throughout RequestReviewPresenter and all affected specs
  • Specs: Replaced allow_any_instance_of auth mocks with real Enrollment.create! records (main's approach); combined our RequestReviewPresenter assertions with main's @student_enrollment assertions in the show spec
  • request_service.rb: Deleted (removed in main)

cycomachead and others added 2 commits August 6, 2026 00:04
Adds a RequestReviewPresenter and a view partial that surface the context
an instructor needs when reviewing an extension request before deciding:
- student email and an "extended requests allowed" badge
- submission time with a before/after original-deadline badge
- a direct link to the assignment in the LMS
- the late due date that would be applied on approval
- the student's extension history in the course (status counts + table)
- who processed the request, and (for approved requests) confirmation the
  extension was actually provisioned in the LMS (external_extension_id)

The presenter is built in RequestsController#show only for course staff,
and also supplies @student_enrollment (reused for the Staff Notes section),
avoiding a duplicate enrollment lookup.

Synced onto main: the earlier staff_user?/role-check migration and the
spec-factory canvas_uid fix from this branch are now upstream (main added
Course#staff_user? and renamed UserToCourse -> Enrollment), so this commit
carries only the review-context feature, adapted to those APIs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Introduce RequestReviewPresenter to aggregate student enrollment and history
- Add student extension history partial with email, badges, and LMS links
- Integrate review context into RequestsController#show within staff guards
- Add disabled placeholder for LMS provisioning status to avoid inconsistency
- Update specs for new enrollment schema and presenter logic

Co-authored-by: Claude Code <noreply@anthropic.com>
@superconductor-for-github
superconductor-for-github Bot force-pushed the cycomachead/151-improve-request-show-instructor/1 branch from 5262d4e to cd7f24e Compare August 6, 2026 01:58
…tor/1

* main:
  Tidy the footer a bit
  Reorganize the sync buttons on the assignments page
  Update cron job times to 4:00PM
  feat: add hourly email notifications and enable GoodJob cron
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.

2 participants