• 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

25.0
/lib/cadet/notifications/notification_config.ex
1
defmodule Cadet.Notifications.NotificationConfig do
2
  @moduledoc """
3
  NotificationConfig entity to store course/assessment configuration for a specific notification type.
4
  """
5
  use Ecto.Schema
6
  import Ecto.Changeset
7
  alias Cadet.Courses.{Course, AssessmentConfig}
8
  alias Cadet.Notifications.NotificationType
9

10
  schema "notification_configs" do
42✔
11
    field(:is_enabled, :boolean, default: false)
12

13
    belongs_to(:notification_type, NotificationType)
14
    belongs_to(:course, Course)
15
    belongs_to(:assessment_config, AssessmentConfig)
16

17
    timestamps()
18
  end
19

20
  @doc false
21
  def changeset(notification_config, attrs) do
22
    notification_config
23
    |> cast(attrs, [:is_enabled, :notification_type_id, :course_id])
24
    |> validate_required([:notification_type_id, :course_id])
UNCOV
25
    |> prevent_nil_is_enabled()
×
26
  end
27

28
  defp prevent_nil_is_enabled(changeset = %{changes: %{is_enabled: is_enabled}})
29
       when is_nil(is_enabled),
UNCOV
30
       do: add_error(changeset, :full_name, "empty")
×
31

32
  defp prevent_nil_is_enabled(changeset),
UNCOV
33
    do: changeset
×
34
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