• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

source-academy / backend / e0330f2cf38b2d8af12bffd20f4cac2158d607fc-PR-1236

31 Mar 2025 09:12AM UTC coverage: 19.982% (-73.6%) from 93.607%
e0330f2cf38b2d8af12bffd20f4cac2158d607fc-PR-1236

Pull #1236

github

RichDom2185
Redate migrations to maintain total ordering
Pull Request #1236: Added Exam mode

12 of 57 new or added lines in 8 files covered. (21.05%)

2430 existing lines in 97 files now uncovered.

671 of 3358 relevant lines covered (19.98%)

3.03 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/lib/cadet/accounts/notification.ex
1
defmodule Cadet.Accounts.Notification do
2
  @moduledoc """
3
  The Notification entity represents a notification.
4
  It stores information pertaining to the type of notification and who in which course it belongs to.
5
  Each notification can have an assessment id or submission id, with optional question id.
6
  This will be used to pinpoint where the notification will be showed on the frontend.
7
  """
8
  use Cadet, :model
9

10
  alias Cadet.Accounts.{NotificationType, Role, CourseRegistration}
11
  alias Cadet.Assessments.{Assessment, Submission}
12

UNCOV
13
  schema "notifications" do
×
14
    field(:type, NotificationType)
15
    field(:read, :boolean, default: false)
16
    field(:role, Role, virtual: true)
17

18
    belongs_to(:course_reg, CourseRegistration)
19
    belongs_to(:assessment, Assessment)
20
    belongs_to(:submission, Submission)
21

22
    timestamps()
23
  end
24

25
  @required_fields ~w(type read course_reg_id assessment_id)a
26
  @optional_fields ~w(submission_id)a
27

28
  def changeset(answer, params) do
29
    answer
30
    |> cast(params, @required_fields ++ @optional_fields)
31
    |> validate_required(@required_fields)
32
    |> foreign_key_constraint(:course_reg_id)
33
    |> foreign_key_constraint(:assessment_id)
UNCOV
34
    |> foreign_key_constraint(:submission_id)
×
35
  end
36
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc