Function resubmit_submissions

Source
pub async fn resubmit_submissions(
    __arg0: State<AppState>,
    __arg1: Path<(i64, i64)>,
    __arg2: Extension<AuthUser>,
    __arg3: Json<ResubmitRequest>,
) -> impl IntoResponse
Expand description

POST /api/modules/{module_id}/assignments/{assignment_id}/submissions/resubmit

Reprocess assignment submissions using the latest marking pipeline. Accessible to admins, module lecturers, and assistant lecturers.

This endpoint allows authorized users to rerun the entire submission pipeline (code execution + marking) on either:

  • Specific submissions (via submission_ids)
  • All submissions in an assignment (via all: true)

§Path Parameters

  • module_id (i64): The ID of the module containing the assignment
  • assignment_id (i64): The ID of the assignment containing the submissions

§Request Body

Either:

{ "submission_ids": [123, 124, 125] }

or

{ "all": true }

§Success Response (200 OK)

{
  "success": true,
  "message": "Resubmitted 3/4 submissions",
  "data": {
    "resubmitted": 3,
    "failed": [
      { "id": 125, "error": "Submission not found" }
    ]
  }
}

§Error Responses

400 Bad Request - Invalid request parameters

{ "success": false, "message": "Must provide exactly one of submission_ids or all=true" }

or

{ "success": false, "message": "submission_ids cannot be empty" }

403 Forbidden - User not authorized for operation

{ "success": false, "message": "Not authorized to resubmit submissions" }

404 Not Found - Assignment not found

{ "success": false, "message": "Assignment not found" }

500 Internal Server Error - Resubmission failure

{ "success": false, "message": "Failed to load mark allocator" }

or

{ "success": false, "message": "Failed to run code for submission" }

§Side Effects

  • Re-executes code for all target submissions
  • Regenerates marking reports and saves updated submission_report.json files
  • Updates submission status transitions as applicable

§Notes

  • Resubmission reruns the entire pipeline: code execution → marking → report generation
  • This differs from remark which only reruns the marking phase
  • The endpoint is restricted to admin, module lecturer, and assistant lecturer roles
  • All errors are returned in a consistent JSON format with per-submission failure details