Skip to content

E2602 - Spring - Backend Changes#322

Open
ravisatyarsg wants to merge 5 commits intoexpertiza:mainfrom
ravisatyarsg:main
Open

E2602 - Spring - Backend Changes#322
ravisatyarsg wants to merge 5 commits intoexpertiza:mainfrom
ravisatyarsg:main

Conversation

@ravisatyarsg
Copy link
Copy Markdown

This PR implements the frontend for the Student Task View (E2602) in React + TypeScript. The previous StudentTasks component was incorrectly implemented as a topic signup sheet. This PR replaces it with a correct task list view and adds a new task detail view, both fully integrated with the backend API.
Changes
New files:

src/pages/StudentTasks/StudentTasks.tsx — rewrites the list view to call GET /student_tasks and render a table of all assigned tasks
src/pages/StudentTasks/StudentTaskDetail.tsx — new detail view calling GET /student_tasks/:id, renders assignment info, team, stage timeline, reviewer feedback, submission feedback, and revision request form
src/pages/StudentTasks/StudentTaskColumns.tsx — TanStack column definitions with clickable assignment name links and colored stage badges
src/pages/StudentTasks/studentTaskTypes.ts — TypeScript interfaces matching the backend as_json response shape
src/pages/StudentTasks/tests/StudentTasks.test.tsx — 14 tests for the list view
src/pages/StudentTasks/tests/StudentTaskDetail.test.tsx — 20 tests for the detail view

Modified files:

src/App.tsx — added StudentTaskDetail import and updated the student_tasks/:participantId route to point to the new detail component

Features

Task list table with assignment, course, topic, current stage badge, stage deadline, and review grade columns
Navigation from list to detail via assignment name link or "View Details" button
Detail page with stage timeline (submission → review → feedback phases with status badges), team members, reviewer feedback, submission feedback, and revision request form
Loading state, empty state, and error state handled in both views
Redux alert dispatched on API failure
Both routes protected with ProtectedRoute

Tests (34 total, all passing)

Rendering: task table, column data, stage badges, grade display
Navigation: assignment name click, View Details button click, back button
States: loading, empty, error alert dispatch
Detail rendering: assignment title, course, stage badge, topic, team, timeline, feedback, submission feedback, revision card
Revision form: show/hide, submit disabled when empty, enabled after typing, existing status display
API: correct URL and method called on mount for both components

Testing
npm test

press 'p' then type 'StudentTask' to filter to E2602 tests

34 tests, all passing

Backend PR
Title: E2602 — Stabilize and test Student Task View backend (Rails API)
Description:
Summary
This PR stabilizes and completes the backend for the Student Task View (E2602). It hardens the StudentTasksController, implements the StudentTask model for composed task payload construction, adds revision request support, and provides comprehensive RSpec test coverage across request, model, and routing specs.
Changes
New files:

app/models/student_task.rb — composed task payload built from AssignmentParticipant and related models (assignment, course, team, topic, deadlines, timeline, feedback, revision request)
app/models/revision_request.rb — persistent revision request model linking participant, team, and assignment with status validation and pending-request uniqueness
db/migrate/20260322174500_create_revision_requests.rb — creates the revision_requests table
spec/requests/api/v1/student_tasks_controller_spec.rb — 457 lines of request specs
spec/models/student_task_spec.rb — 185 lines of model specs
spec/routing/student_tasks_routing_spec.rb — routing specs

Modified files:

app/controllers/student_tasks_controller.rb — hardened with ownership checks (403 for cross-student access), not-found handling (404), and revision request submission action
config/routes.rb — added request_revision member route, list and view collection routes, and revision_requests resource routes

Authorization

401 returned for requests without a valid JWT
403 returned when a student accesses another student's task
404 returned for invalid participant IDs
Revision approval/decline restricted to the assignment instructor

Tests (56 examples, 0 failures)
Request specs:

Successful task list retrieval with full payload validation
Empty task list for student with no assignments
Unauthorized access without token
Successful task detail retrieval
Forbidden access to another student's task
Invalid task ID (not found)
Revision request creation, duplicate rejection, and ineligible task rejection
Instructor revision review flows

Model specs:

Task payload construction from participant
JSON serialization shape
Participant lookup and nil handling
Deadline parsing
can_request_revision logic for all states

Testing
bashdocker compose exec app bundle exec rspec
spec/requests/api/v1/student_tasks_controller_spec.rb
spec/models/student_task_spec.rb
spec/routing/student_tasks_routing_spec.rb
--format documentation

@github-actions
Copy link
Copy Markdown

5 Warnings
⚠️ Pull request is too big (more than 500 LoC).
⚠️ Pull request modifies markdown files (*.md). Make sure you have a good reason.
⚠️ Schema changes detected without a corresponding DB migration.
⚠️ Pull request modifies config or setup files: config/database.yml, setup.sh.
⚠️ RSpec tests seem shallow (single it blocks or no context). Consider improving test structure.

Generated by 🚫 Danger

FROM ruby:3.4.5

LABEL maintainer="Ankur Mundra <ankurmundra0212@gmail.com>"
# Install dependencies
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Revisions to shared files like this are likely going to lead to conflicts and reduce the chance of this PR ever getting merged.

end
collection do
get :list, action: :list
get :view
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is this expecting an :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.

No. Since this is a collection route, it does not take :id in the path. It expects GET /student_tasks/view?id=:id as a query-param alias to GET /student_tasks/:id.

host: <%= ENV.fetch("DB_HOST", "127.0.0.1") %>
port: <%= ENV.fetch("DB_PORT", 3306) %>
username: <%= ENV.fetch("DB_USERNAME", "root") %>
password: <%= ENV.fetch("DB_PASSWORD", "expertiza") %>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I do think the default changes are valid, however, if I'm deciding to merge this or not, the changes below would make me very nervous.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

updated it.

@@ -0,0 +1,155 @@
Backend implementation report for the Student Task View work described in instructions.txt
Copy link
Copy Markdown

@johnmweisz johnmweisz Apr 2, 2026

Choose a reason for hiding this comment

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

I think this is what the Wiki is for, consider removing this AI generated file.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Have deleted it.

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.

3 participants