Skip to content

Commit 026ef36

Browse files
authored
add contest score job logging (#906)
* add contest score job logging * fix credo
1 parent 4aa9721 commit 026ef36

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

lib/cadet/assessments/assessments.ex

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ defmodule Cadet.Assessments do
66
use Cadet, [:context, :display]
77
import Ecto.Query
88

9+
require Logger
10+
911
alias Cadet.Accounts.{Notification, Notifications, User, CourseRegistration}
1012
alias Cadet.Assessments.{Answer, Assessment, Query, Question, Submission, SubmissionVotes}
1113
alias Cadet.Autograder.GradingJob
@@ -995,10 +997,15 @@ defmodule Cadet.Assessments do
995997
def update_rolling_contest_leaderboards do
996998
# 115 = 2 hours - 5 minutes
997999
if Log.log_execution("update_rolling_contest_leaderboards", Timex.Duration.from_minutes(115)) do
1000+
Logger.info("Started update_rolling_contest_leaderboards")
1001+
9981002
voting_questions_to_update = fetch_active_voting_questions()
9991003

1000-
voting_questions_to_update
1001-
|> Enum.map(fn qn -> compute_relative_score(qn.id) end)
1004+
_ =
1005+
voting_questions_to_update
1006+
|> Enum.map(fn qn -> compute_relative_score(qn.id) end)
1007+
1008+
Logger.info("Successfully update_rolling_contest_leaderboards")
10021009
end
10031010
end
10041011

@@ -1016,11 +1023,16 @@ defmodule Cadet.Assessments do
10161023
"""
10171024
def update_final_contest_leaderboards do
10181025
# 1435 = 24 hours - 5 minutes
1019-
if Log.log_execution("update_rolling_contest_leaderboards", Timex.Duration.from_minutes(1435)) do
1026+
if Log.log_execution("update_final_contest_leaderboards", Timex.Duration.from_minutes(1435)) do
1027+
Logger.info("Started update_final_contest_leaderboards")
1028+
10201029
voting_questions_to_update = fetch_voting_questions_due_yesterday()
10211030

1022-
voting_questions_to_update
1023-
|> Enum.map(fn qn -> compute_relative_score(qn.id) end)
1031+
_ =
1032+
voting_questions_to_update
1033+
|> Enum.map(fn qn -> compute_relative_score(qn.id) end)
1034+
1035+
Logger.info("Successfully update_final_contest_leaderboards")
10241036
end
10251037
end
10261038

0 commit comments

Comments
 (0)