Skip to content

Commit d867927

Browse files
authored
feat: Add check to notification creation (#1167)
1 parent e84c941 commit d867927

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/cadet/assessments/assessments.ex

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,12 @@ defmodule Cadet.Assessments do
10211021
with {:status, :attempted} <- {:status, submission.status},
10221022
{:ok, updated_submission} <- update_submission_status(submission) do
10231023
# Couple with update_submission_status and update_xp_bonus to ensure notification is sent
1024-
Notifications.write_notification_when_student_submits(submission)
1024+
submission = Repo.preload(submission, assessment: [:config])
1025+
1026+
if submission.assessment.config.is_manually_graded do
1027+
Notifications.write_notification_when_student_submits(submission)
1028+
end
1029+
10251030
# Send email notification to avenger
10261031
%{notification_type: "assessment_submission", submission_id: updated_submission.id}
10271032
|> Cadet.Workers.NotificationWorker.new()

0 commit comments

Comments
 (0)