diff --git a/lib/cadet/assessments/assessments.ex b/lib/cadet/assessments/assessments.ex index 8e5956f8c..875a0095b 100644 --- a/lib/cadet/assessments/assessments.ex +++ b/lib/cadet/assessments/assessments.ex @@ -1985,7 +1985,7 @@ defmodule Cadet.Assessments do where: s.assessment_id in subquery(build_assessment_config_filter(params)), where: ^build_submission_filter(params), where: ^build_course_registration_filter(params, grader), - limit: ^params[:limit], + limit: ^params[:page_size], offset: ^params[:offset], select: %{ id: s.id, diff --git a/test/cadet/assessments/assessments_test.exs b/test/cadet/assessments/assessments_test.exs index 6c36cd1d1..6953144c3 100644 --- a/test/cadet/assessments/assessments_test.exs +++ b/test/cadet/assessments/assessments_test.exs @@ -2210,6 +2210,29 @@ defmodule Cadet.AssessmentsTest do Map.put(seed, :total_submissions, total_submissions) end + test "limit submissions", %{ + course_regs: %{avenger1_cr: avenger} + } do + {_, res} = + Assessments.submissions_by_grader_for_index(avenger, %{ + :page_size => 1 + }) + + assert length(res[:data][:submissions]) == 1 + end + + test "limit submisssions 2", %{ + course_regs: %{avenger1_cr: avenger}, + assessments: assessments + } do + {_, res} = + Assessments.submissions_by_grader_for_index(avenger, %{ + :page_size => 2 + }) + + assert length(res[:data][:submissions]) == 2 + end + test "filter by assessment title", %{ course_regs: %{avenger1_cr: avenger}, assessments: assessments,