Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RichDom2185 committed Sep 20, 2024
1 parent f8187e3 commit bd430a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions lib/cadet/assessments/assessments.ex
Original file line number Diff line number Diff line change
Expand Up @@ -678,17 +678,16 @@ defmodule Cadet.Assessments do
end
end

def is_voting_published(assessment_id) do
defp is_voting_published(assessment_id) do
voting_assigned_question_ids =
SubmissionVotes
|> select([v], v.question_id)
|> Repo.all()

Question
|> where(type: :voting)
|> where(assessment_id: ^assessment_id)
|> where([q], q.id in ^voting_assigned_question_ids)
|> Repo.exists?()
|> where([q], q.id in subquery(voting_assigned_question_ids))
|> Repo.exists?() == true
end

def update_final_contest_entries do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ defmodule CadetWeb.AdminAssessmentsControllerTest 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
}
)

Expand Down Expand Up @@ -145,7 +145,7 @@ defmodule CadetWeb.AdminAssessmentsControllerTest 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
}
)

Expand Down

0 comments on commit bd430a8

Please sign in to comment.