Skip to content

Commit

Permalink
fix: handle nil build in calculate_attempt_marks function
Browse files Browse the repository at this point in the history
  • Loading branch information
padmaJS committed Dec 2, 2024
1 parent 8f802bd commit 1720e5f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/handin/assignment_submissions.ex
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,12 @@ defmodule Handin.AssignmentSubmissions do
Enum.find(submissions, &(&1.user_id == user_id))
end

defp calculate_attempt_marks(nil, _attempt_marks), do: 0

defp calculate_attempt_marks(build, attempt_marks) do
if build && build.run_script_result.state == :pass, do: attempt_marks, else: 0
if build.run_script_result && build.run_script_result.state == :pass,
do: attempt_marks,
else: 0
end

defp calculate_test_result_marks(nil, assignment_tests) do
Expand Down

0 comments on commit 1720e5f

Please sign in to comment.