Skip to content

Commit 45b47d4

Browse files
committed
Fix admin assessments controller
1 parent c0ae608 commit 45b47d4

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

lib/cadet/assessments/assessments.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ defmodule Cadet.Assessments do
687687
|> where(type: :voting)
688688
|> where(assessment_id: ^assessment_id)
689689
|> where([q], q.id in subquery(voting_assigned_question_ids))
690-
|> Repo.exists?() == true
690+
|> Repo.exists?() || false
691691
end
692692

693693
def update_final_contest_entries do

lib/cadet_web/admin_controllers/admin_assessments_controller.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ defmodule CadetWeb.AdminAssessmentsController do
1414
def index(conn, %{"course_reg_id" => course_reg_id}) do
1515
course_reg = Repo.get(CourseRegistration, course_reg_id)
1616
{:ok, assessments} = Assessments.all_assessments(course_reg)
17-
17+
assessments = Assessments.format_all_assessments(assessments)
1818
render(conn, "index.json", assessments: assessments)
1919
end
2020

test/cadet_web/admin_controllers/admin_assessments_controller_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ defmodule CadetWeb.AdminAssessmentsControllerTest do
9090
"isPublished" => &1.is_published,
9191
"gradedCount" => 0,
9292
"questionCount" => 9,
93-
"xp" => (800 + 500 + 100) * 3,
93+
"xp" => (if &1.is_grading_published, do: (800 + 500 + 100) * 3, else: 0),
9494
"earlySubmissionXp" => &1.config.early_submission_xp,
9595
"hasVotingFeatures" => &1.has_voting_features,
9696
"hasTokenCounter" => &1.has_token_counter,

test/cadet_web/controllers/assessments_controller_test.exs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ defmodule CadetWeb.AssessmentsControllerTest do
8383
"earlySubmissionXp" => &1.config.early_submission_xp,
8484
"hasVotingFeatures" => &1.has_voting_features,
8585
"hasTokenCounter" => &1.has_token_counter,
86-
"isVotingPublished" => Assessments.is_voting_published(&1.id),
86+
"isVotingPublished" => false,
8787
"hoursBeforeEarlyXpDecay" => &1.config.hours_before_early_xp_decay
8888
}
8989
)
@@ -174,7 +174,7 @@ defmodule CadetWeb.AssessmentsControllerTest do
174174
"earlySubmissionXp" => &1.config.early_submission_xp,
175175
"hasVotingFeatures" => &1.has_voting_features,
176176
"hasTokenCounter" => &1.has_token_counter,
177-
"isVotingPublished" => Assessments.is_voting_published(&1.id),
177+
"isVotingPublished" => false,
178178
"hoursBeforeEarlyXpDecay" => &1.config.hours_before_early_xp_decay
179179
}
180180
)
@@ -288,7 +288,7 @@ defmodule CadetWeb.AssessmentsControllerTest do
288288
"questionCount" => 9,
289289
"hasVotingFeatures" => &1.has_voting_features,
290290
"hasTokenCounter" => &1.has_token_counter,
291-
"isVotingPublished" => Assessments.is_voting_published(&1.id),
291+
"isVotingPublished" => false,
292292
"earlySubmissionXp" => &1.config.early_submission_xp,
293293
"isGradingPublished" => nil,
294294
"hoursBeforeEarlyXpDecay" => &1.config.hours_before_early_xp_decay,

0 commit comments

Comments
 (0)