From 4731838c05f19872cdb700c40ccd9881d5a4d84c Mon Sep 17 00:00:00 2001
From: josh1248 <joshthoo@gmail.com>
Date: Wed, 13 Nov 2024 22:56:08 +0800
Subject: [PATCH 1/5] Add endpoint

---
 .../admin_grading_controller.ex               | 19 ++++++++++++++++++-
 lib/cadet_web/router.ex                       |  2 ++
 priv/repo/seeds.exs                           |  2 +-
 3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/lib/cadet_web/admin_controllers/admin_grading_controller.ex b/lib/cadet_web/admin_controllers/admin_grading_controller.ex
index 5f349edb0..ff96aa498 100644
--- a/lib/cadet_web/admin_controllers/admin_grading_controller.ex
+++ b/lib/cadet_web/admin_controllers/admin_grading_controller.ex
@@ -58,6 +58,21 @@ defmodule CadetWeb.AdminGradingController do
     index(conn, %{"group" => "false"})
   end
 
+  @doc """
+  # Description
+  Attains every assessment submission registered, regardless of grading or attempted status.
+  This is a special call of the general `index` submission whereby pagination is bypassed.
+  """
+  def index_all_submissions(conn, _) do
+    # 100 billion page size here should cover all feasible table rows in 1 page
+    # given that the hard limit of pages in a postgres database is ~4 billion.
+    # (https://www.postgresql.org/docs/current/limits.html)
+    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}} ->
@@ -367,7 +382,9 @@ defmodule CadetWeb.AdminGradingController do
               required: true
             )
 
-            student(Schema.ref(:StudentInfo), "Student who created the submission", required: true)
+            student(Schema.ref(:StudentInfo), "Student who created the submission",
+              required: true
+            )
 
             unsubmittedBy(Schema.ref(:GraderInfo))
             unsubmittedAt(:string, "Last unsubmitted at", format: "date-time", required: false)
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,
diff --git a/priv/repo/seeds.exs b/priv/repo/seeds.exs
index 57173cea0..d6addc8bb 100644
--- a/priv/repo/seeds.exs
+++ b/priv/repo/seeds.exs
@@ -26,7 +26,7 @@ alias Cadet.Accounts.{
 # Cadet.Repo.insert!(%Cadet.Settings.Sublanguage{chapter: 1, variant: "default"})
 
 if Cadet.Env.env() == :dev do
-  number_of_students = 100_000
+  number_of_students = 100
   number_of_assessments = 5
   number_of_questions = 13
 

From 6d9c948fa08dd9c0a5348a59121e2d2b9ab86c1f Mon Sep 17 00:00:00 2001
From: josh1248 <joshthoo@gmail.com>
Date: Wed, 13 Nov 2024 23:09:10 +0800
Subject: [PATCH 2/5] Shorten comments

---
 .../admin_controllers/admin_grading_controller.ex      | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/lib/cadet_web/admin_controllers/admin_grading_controller.ex b/lib/cadet_web/admin_controllers/admin_grading_controller.ex
index ff96aa498..3c81b6fd6 100644
--- a/lib/cadet_web/admin_controllers/admin_grading_controller.ex
+++ b/lib/cadet_web/admin_controllers/admin_grading_controller.ex
@@ -60,17 +60,15 @@ defmodule CadetWeb.AdminGradingController do
 
   @doc """
   # Description
-  Attains every assessment submission registered, regardless of grading or attempted status.
-  This is a special call of the general `index` submission whereby pagination is bypassed.
+  Attains every assessment submission registered, regardless of grading
+  or attempted status. This is a special call of the general `index`
+  submission whereby pagination is bypassed.
   """
   def index_all_submissions(conn, _) do
     # 100 billion page size here should cover all feasible table rows in 1 page
     # given that the hard limit of pages in a postgres database is ~4 billion.
     # (https://www.postgresql.org/docs/current/limits.html)
-    index(
-      conn,
-      %{"group" => "false", "pageSize" => "100000000000", "offset" => "0"}
-    )
+    index(conn, %{"group" => "false", "pageSize" => "100000000000", "offset" => "0"})
   end
 
   def show(conn, %{"submissionid" => submission_id}) when is_ecto_id(submission_id) do

From 66128620080d63e16129e203baa783b1bcffbeea Mon Sep 17 00:00:00 2001
From: josh1248 <joshthoo@gmail.com>
Date: Thu, 14 Nov 2024 00:02:00 +0800
Subject: [PATCH 3/5] Formatting

---
 .../admin_grading_controller.ex                | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/lib/cadet_web/admin_controllers/admin_grading_controller.ex b/lib/cadet_web/admin_controllers/admin_grading_controller.ex
index 3c81b6fd6..9e7507bd7 100644
--- a/lib/cadet_web/admin_controllers/admin_grading_controller.ex
+++ b/lib/cadet_web/admin_controllers/admin_grading_controller.ex
@@ -58,17 +58,15 @@ defmodule CadetWeb.AdminGradingController do
     index(conn, %{"group" => "false"})
   end
 
-  @doc """
-  # Description
-  Attains every assessment submission registered, regardless of grading
-  or attempted status. This is a special call of the general `index`
-  submission whereby pagination is bypassed.
-  """
   def index_all_submissions(conn, _) do
-    # 100 billion page size here should cover all feasible table rows in 1 page
-    # given that the hard limit of pages in a postgres database is ~4 billion.
-    # (https://www.postgresql.org/docs/current/limits.html)
-    index(conn, %{"group" => "false", "pageSize" => "100000000000", "offset" => "0"})
+    index(
+      conn,
+      %{
+        "group" => "false",
+        "pageSize" => "100000000000",
+        "offset" => "0"
+      }
+    )
   end
 
   def show(conn, %{"submissionid" => submission_id}) when is_ecto_id(submission_id) do

From b4ff325d8d7546a3151dd5e59b7d6b67ebf95512 Mon Sep 17 00:00:00 2001
From: josh1248 <joshthoo@gmail.com>
Date: Thu, 14 Nov 2024 00:11:28 +0800
Subject: [PATCH 4/5] Formatting (again)

---
 lib/cadet_web/admin_controllers/admin_grading_controller.ex | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lib/cadet_web/admin_controllers/admin_grading_controller.ex b/lib/cadet_web/admin_controllers/admin_grading_controller.ex
index 9e7507bd7..aa93cd30f 100644
--- a/lib/cadet_web/admin_controllers/admin_grading_controller.ex
+++ b/lib/cadet_web/admin_controllers/admin_grading_controller.ex
@@ -378,9 +378,7 @@ defmodule CadetWeb.AdminGradingController do
               required: true
             )
 
-            student(Schema.ref(:StudentInfo), "Student who created the submission",
-              required: true
-            )
+            student(Schema.ref(:StudentInfo), "Student who created the submission", required: true)
 
             unsubmittedBy(Schema.ref(:GraderInfo))
             unsubmittedAt(:string, "Last unsubmitted at", format: "date-time", required: false)

From 85c05001ebeb67dd3a90e9a6853fe08abd79f53e Mon Sep 17 00:00:00 2001
From: Richard Dominick <34370238+RichDom2185@users.noreply.github.com>
Date: Sat, 16 Nov 2024 19:46:09 +0800
Subject: [PATCH 5/5] Revert seed change

---
 priv/repo/seeds.exs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/priv/repo/seeds.exs b/priv/repo/seeds.exs
index d6addc8bb..57173cea0 100644
--- a/priv/repo/seeds.exs
+++ b/priv/repo/seeds.exs
@@ -26,7 +26,7 @@ alias Cadet.Accounts.{
 # Cadet.Repo.insert!(%Cadet.Settings.Sublanguage{chapter: 1, variant: "default"})
 
 if Cadet.Env.env() == :dev do
-  number_of_students = 100
+  number_of_students = 100_000
   number_of_assessments = 5
   number_of_questions = 13