From b406ab02b0eb84a4efb1a359abe98f711fbfbe14 Mon Sep 17 00:00:00 2001 From: Josh Thoo Jen Sen <110712708+josh1248@users.noreply.github.com> Date: Sat, 16 Nov 2024 20:01:29 +0800 Subject: [PATCH] Create endpoint for retrieval of all assessment submissions (#1210) * Add endpoint * Shorten comments * Formatting * Formatting (again) * Revert seed change --------- Co-authored-by: Richard Dominick <34370238+RichDom2185@users.noreply.github.com> --- .../admin_controllers/admin_grading_controller.ex | 11 +++++++++++ lib/cadet_web/router.ex | 2 ++ 2 files changed, 13 insertions(+) diff --git a/lib/cadet_web/admin_controllers/admin_grading_controller.ex b/lib/cadet_web/admin_controllers/admin_grading_controller.ex index 5f349edb0..aa93cd30f 100644 --- a/lib/cadet_web/admin_controllers/admin_grading_controller.ex +++ b/lib/cadet_web/admin_controllers/admin_grading_controller.ex @@ -58,6 +58,17 @@ defmodule CadetWeb.AdminGradingController do index(conn, %{"group" => "false"}) end + def index_all_submissions(conn, _) do + index( + conn, + %{ + "group" => "false", + "pageSize" => "100000000000", + "offset" => "0" + } + ) + end + def show(conn, %{"submissionid" => submission_id}) when is_ecto_id(submission_id) do case Assessments.get_answers_in_submission(submission_id) do {:ok, {answers, assessment}} -> diff --git a/lib/cadet_web/router.ex b/lib/cadet_web/router.ex index 9c73f21da..1ee304c01 100644 --- a/lib/cadet_web/router.ex +++ b/lib/cadet_web/router.ex @@ -144,6 +144,8 @@ defmodule CadetWeb.Router do post("/assessments/:assessmentid", AdminAssessmentsController, :update) delete("/assessments/:assessmentid", AdminAssessmentsController, :delete) + get("/grading/all_submissions", AdminGradingController, :index_all_submissions) + post( "/grading/:assessmentid/publish_all_grades", AdminGradingController,