Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/source-academy/backend in…
Browse files Browse the repository at this point in the history
…to pr/CheongYeeMing/968
  • Loading branch information
RichDom2185 committed Feb 24, 2024
2 parents b308228 + 11154a6 commit bded013
Show file tree
Hide file tree
Showing 11 changed files with 542 additions and 235 deletions.
9 changes: 9 additions & 0 deletions lib/cadet/assessments/answer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ defmodule Cadet.Assessments.Answer do
schema "answers" do
# used to compare answers with others
field(:relative_score, :float, default: 0.0)
field(:popular_score, :float, default: 0.0)
field(:xp, :integer, default: 0)
field(:xp_adjustment, :integer, default: 0)
field(:comments, :string)
Expand Down Expand Up @@ -123,4 +124,12 @@ defmodule Cadet.Assessments.Answer do
answer
|> cast(contest_score_param, [:relative_score])
end

@doc """
Used to update popular_score of answer to contest_score
"""
def popular_score_update_changeset(answer, popular_score_param) do
answer
|> cast(popular_score_param, [:popular_score])
end
end
Loading

0 comments on commit bded013

Please sign in to comment.