• 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_web/views/incentives_view.ex
1
defmodule CadetWeb.IncentivesView do
2
  use CadetWeb, :view
3
  use Timex
4

5
  def render("index_achievements.json", %{achievements: achievements}) do
UNCOV
6
    render_many(achievements, CadetWeb.IncentivesView, "achievement.json", as: :achievement)
×
7
  end
8

9
  def render("achievement.json", %{achievement: achievement}) do
UNCOV
10
    transform_map_for_view(achievement, %{
×
11
      uuid: :uuid,
12
      title: :title,
13
      xp: :xp,
14
      isVariableXp: :is_variable_xp,
UNCOV
15
      release: &format_datetime(&1.open_at),
×
UNCOV
16
      deadline: &format_datetime(&1.close_at),
×
17
      isTask: :is_task,
18
      prerequisiteUuids:
UNCOV
19
        &Enum.map(&1.prerequisites, fn prerequisite -> prerequisite.prerequisite_uuid end),
×
20
      cardBackground: :card_tile_url,
21
      position: :position,
22
      view:
UNCOV
23
        &%{
×
UNCOV
24
          coverImage: &1.canvas_url,
×
UNCOV
25
          description: &1.description,
×
UNCOV
26
          completionText: &1.completion_text
×
27
        },
UNCOV
28
      goalUuids: &Enum.map(&1.goals, fn goal -> goal.goal_uuid end)
×
29
    })
30
  end
31

32
  def render("index_goals_with_progress.json", %{goals: goals}) do
UNCOV
33
    render_many(goals, CadetWeb.IncentivesView, "goal_with_progress.json", as: :goal)
×
34
  end
35

36
  def render("goal_with_progress.json", %{goal: goal}) do
UNCOV
37
    transform_map_for_view(goal, %{
×
38
      uuid: :uuid,
39
      text: :text,
40
      count: fn
UNCOV
41
        %{progress: [%{count: count}]} -> count
×
UNCOV
42
        _ -> 0
×
43
      end,
44
      completed: fn
UNCOV
45
        %{progress: [%{completed: completed}]} -> completed
×
UNCOV
46
        _ -> false
×
47
      end,
48
      targetCount: :target_count,
49
      type: :type,
50
      meta: :meta,
51
      achievementUuids:
UNCOV
52
        &Enum.map(&1.achievements, fn achievement -> achievement.achievement_uuid end)
×
53
    })
54
  end
55
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