Skip to content

Commit

Permalink
Fix admin assessments controller
Browse files Browse the repository at this point in the history
  • Loading branch information
RichDom2185 committed Sep 20, 2024
1 parent c0ae608 commit 45b47d4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/cadet/assessments/assessments.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions test/cadet_web/controllers/assessments_controller_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
)
Expand Down Expand Up @@ -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
}
)
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 45b47d4

Please sign in to comment.