diff --git a/lib/cadet/assessments/assessments.ex b/lib/cadet/assessments/assessments.ex index 5af40d9c2..8e5956f8c 100644 --- a/lib/cadet/assessments/assessments.ex +++ b/lib/cadet/assessments/assessments.ex @@ -687,7 +687,7 @@ defmodule Cadet.Assessments do |> where(type: :voting) |> where(assessment_id: ^assessment_id) |> where([q], q.id in subquery(voting_assigned_question_ids)) - |> Repo.exists?() == true + |> Repo.exists?() || false end def update_final_contest_entries do diff --git a/lib/cadet_web/admin_controllers/admin_assessments_controller.ex b/lib/cadet_web/admin_controllers/admin_assessments_controller.ex index d9a992267..9263195f2 100644 --- a/lib/cadet_web/admin_controllers/admin_assessments_controller.ex +++ b/lib/cadet_web/admin_controllers/admin_assessments_controller.ex @@ -14,7 +14,7 @@ defmodule CadetWeb.AdminAssessmentsController do def index(conn, %{"course_reg_id" => course_reg_id}) do course_reg = Repo.get(CourseRegistration, course_reg_id) {:ok, assessments} = Assessments.all_assessments(course_reg) - + assessments = Assessments.format_all_assessments(assessments) render(conn, "index.json", assessments: assessments) end diff --git a/test/cadet_web/admin_controllers/admin_assessments_controller_test.exs b/test/cadet_web/admin_controllers/admin_assessments_controller_test.exs index 2f32cc172..4d2a7601b 100644 --- a/test/cadet_web/admin_controllers/admin_assessments_controller_test.exs +++ b/test/cadet_web/admin_controllers/admin_assessments_controller_test.exs @@ -90,7 +90,7 @@ defmodule CadetWeb.AdminAssessmentsControllerTest do "isPublished" => &1.is_published, "gradedCount" => 0, "questionCount" => 9, - "xp" => (800 + 500 + 100) * 3, + "xp" => (if &1.is_grading_published, do: (800 + 500 + 100) * 3, else: 0), "earlySubmissionXp" => &1.config.early_submission_xp, "hasVotingFeatures" => &1.has_voting_features, "hasTokenCounter" => &1.has_token_counter, diff --git a/test/cadet_web/controllers/assessments_controller_test.exs b/test/cadet_web/controllers/assessments_controller_test.exs index f1cc9beb0..d17eee839 100644 --- a/test/cadet_web/controllers/assessments_controller_test.exs +++ b/test/cadet_web/controllers/assessments_controller_test.exs @@ -83,7 +83,7 @@ defmodule CadetWeb.AssessmentsControllerTest do "earlySubmissionXp" => &1.config.early_submission_xp, "hasVotingFeatures" => &1.has_voting_features, "hasTokenCounter" => &1.has_token_counter, - "isVotingPublished" => Assessments.is_voting_published(&1.id), + "isVotingPublished" => false, "hoursBeforeEarlyXpDecay" => &1.config.hours_before_early_xp_decay } ) @@ -174,7 +174,7 @@ defmodule CadetWeb.AssessmentsControllerTest do "earlySubmissionXp" => &1.config.early_submission_xp, "hasVotingFeatures" => &1.has_voting_features, "hasTokenCounter" => &1.has_token_counter, - "isVotingPublished" => Assessments.is_voting_published(&1.id), + "isVotingPublished" => false, "hoursBeforeEarlyXpDecay" => &1.config.hours_before_early_xp_decay } ) @@ -288,7 +288,7 @@ defmodule CadetWeb.AssessmentsControllerTest do "questionCount" => 9, "hasVotingFeatures" => &1.has_voting_features, "hasTokenCounter" => &1.has_token_counter, - "isVotingPublished" => Assessments.is_voting_published(&1.id), + "isVotingPublished" => false, "earlySubmissionXp" => &1.config.early_submission_xp, "isGradingPublished" => nil, "hoursBeforeEarlyXpDecay" => &1.config.hours_before_early_xp_decay,