• 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

50.0
/lib/cadet/incentives/goal.ex
1
defmodule Cadet.Incentives.Goal do
2
  @moduledoc """
3
  Represents a goal.
4
  """
5
  use Cadet, :model
6

7
  alias Cadet.Courses.Course
8
  alias Cadet.Incentives.{AchievementToGoal, GoalProgress}
9

10
  @type t :: %__MODULE__{}
11

12
  @primary_key {:uuid, :binary_id, autogenerate: false}
13
  schema "goals" do
8✔
14
    field(:text, :string)
15
    field(:target_count, :integer)
16

17
    field(:type, :string)
18
    field(:meta, :map)
19

20
    belongs_to(:course, Course)
21
    has_many(:progress, GoalProgress, foreign_key: :goal_uuid)
22
    has_many(:achievements, AchievementToGoal, on_replace: :delete_if_exists)
23
  end
24

25
  @required_fields ~w(uuid text target_count type meta course_id)a
26

27
  def changeset(goal, params) do
28
    goal
29
    |> cast(params, @required_fields)
30
    |> validate_required(@required_fields)
UNCOV
31
    |> foreign_key_constraint(:course_id)
×
32
  end
33
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