Skip to content

Commit

Permalink
feat: Add check to notification creation
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielCWT committed Aug 31, 2024
1 parent e84c941 commit d46fc8b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/cadet/assessments/assessments.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,12 @@ defmodule Cadet.Assessments do
with {:status, :attempted} <- {:status, submission.status},
{:ok, updated_submission} <- update_submission_status(submission) do
# Couple with update_submission_status and update_xp_bonus to ensure notification is sent
Notifications.write_notification_when_student_submits(submission)
submission = Repo.preload(submission, assessment: [:config])

if submission.assessment.config.is_manually_graded do
Notifications.write_notification_when_student_submits(submission)
end

# Send email notification to avenger
%{notification_type: "assessment_submission", submission_id: updated_submission.id}
|> Cadet.Workers.NotificationWorker.new()
Expand Down

0 comments on commit d46fc8b

Please sign in to comment.