Skip to content

Commit 4e19a57

Browse files
authored
fix: Fix notifications of type "submitted" not being read (#1163)
* fix: Mark notifications for grading as read when publishing grading * chore: Formatting * feat: Acknowledge grading notification when unsubmitting submission
1 parent 2d43f01 commit 4e19a57

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/cadet/assessments/assessments.ex

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,13 @@ defmodule Cadet.Assessments do
11391139
)
11401140
end
11411141

1142+
# Remove grading notifications for submissions
1143+
Notification
1144+
|> where(submission_id: ^submission_id, type: :submitted)
1145+
|> select([n], n.id)
1146+
|> Repo.all()
1147+
|> Notifications.acknowledge(cr)
1148+
11421149
{:ok, nil}
11431150
else
11441151
{:submission_found?, false} ->
@@ -1250,6 +1257,12 @@ defmodule Cadet.Assessments do
12501257
:published_grading
12511258
)
12521259

1260+
Notification
1261+
|> where(submission_id: ^submission.id, type: :submitted)
1262+
|> select([n], n.id)
1263+
|> Repo.all()
1264+
|> Notifications.acknowledge(cr)
1265+
12531266
{:ok, nil}
12541267

12551268
{:submission_found?, false} ->

0 commit comments

Comments
 (0)