Skip to content

Commit

Permalink
fix: Fix notifications of type "submitted" not being read (#1163)
Browse files Browse the repository at this point in the history
* fix: Mark notifications for grading as read when publishing grading

* chore: Formatting

* feat: Acknowledge grading notification when unsubmitting submission
  • Loading branch information
GabrielCWT authored Aug 29, 2024
1 parent 2d43f01 commit 4e19a57
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/cadet/assessments/assessments.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,13 @@ defmodule Cadet.Assessments do
)
end

# Remove grading notifications for submissions
Notification
|> where(submission_id: ^submission_id, type: :submitted)
|> select([n], n.id)
|> Repo.all()
|> Notifications.acknowledge(cr)

{:ok, nil}
else
{:submission_found?, false} ->
Expand Down Expand Up @@ -1250,6 +1257,12 @@ defmodule Cadet.Assessments do
:published_grading
)

Notification
|> where(submission_id: ^submission.id, type: :submitted)
|> select([n], n.id)
|> Repo.all()
|> Notifications.acknowledge(cr)

{:ok, nil}

{:submission_found?, false} ->
Expand Down

0 comments on commit 4e19a57

Please sign in to comment.