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

pulibrary / tigerdata-app / dfca9de0-8fcf-498d-8a60-9314b942ca2e

23 Oct 2025 05:39PM UTC coverage: 91.178% (+2.4%) from 88.782%
dfca9de0-8fcf-498d-8a60-9314b942ca2e

push

circleci

web-flow
Fix fixture_path to fixture_paths deprecation warning (#2090)

2739 of 3004 relevant lines covered (91.18%)

754.12 hits per line

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

96.83
/app/presenters/request_presenter.rb
1
# frozen_string_literal: true
2
class RequestPresenter
6✔
3
  attr_reader :request
6✔
4
  def initialize(request)
6✔
5
    @request = request
200✔
6
  end
7

8
  def eligible_to_edit?(user)
6✔
9
    return false if user.nil?
42✔
10
    if request.submitted?
42✔
11
      user.eligible_sysadmin?
22✔
12
    else
13
      user.uid == request.requested_by || user.eligible_sysadmin?
20✔
14
    end
15
  end
16

17
  def data_sponsor
6✔
18
    full_name(request.data_sponsor)
24✔
19
  end
20

21
  def data_manager
6✔
22
    full_name(request.data_manager)
26✔
23
  end
24

25
  def full_name(uid)
6✔
26
    return "" if uid.blank?
56✔
27
    user = User.find_by(uid: uid)
48✔
28
    user.display_name_safe.to_s
48✔
29
  end
30

31
  # Returns the correct CSS class suffix for the sidebar navigation progress for a given
32
  # step/substep.
33
  def sidebar_progress(controller, step, substep = nil)
6✔
34
    controller_name = controller.controller_name
540✔
35
    case step
540✔
36
    when 1
37
      step1_css_suffix(controller_name, substep)
216✔
38
    when 2
39
      step2_css_suffix(controller_name)
108✔
40
    when 3
41
      step3_css_suffix(controller_name)
108✔
42
    when 4
43
      step4_css_suffix(controller_name)
108✔
44
    else
45
      "-incomplete"
×
46
    end
47
  end
48

49
  private
6✔
50

51
    def step1_css_suffix(controller_name, substep = nil)
6✔
52
      css_suffix = "-incomplete"
216✔
53
      if substep.nil?
216✔
54
        return "-current" if controller_name.start_with?("project_information")
108✔
55
        if step1_valid?
70✔
56
          css_suffix = "-completed"
24✔
57
        end
58
      elsif substep == "Basic Details"
108✔
59
        return "-current" if controller_name == "project_information"
108✔
60
        if step1_valid?
74✔
61
          css_suffix = "-completed"
24✔
62
        end
63
      end
64
      css_suffix
144✔
65
    end
66

67
    def step2_css_suffix(controller_name)
6✔
68
      return "-current" if controller_name == "roles_and_people"
108✔
69
      if step2_valid?
86✔
70
        "-completed"
14✔
71
      else
72
        "-incomplete"
72✔
73
      end
74
    end
75

76
    def step3_css_suffix(controller_name)
6✔
77
      return "-current" if controller_name == "storage_and_access"
108✔
78
      if step3_valid?
96✔
79
        "-completed"
18✔
80
      else
81
        "-incomplete"
78✔
82
      end
83
    end
84

85
    def step4_css_suffix(controller_name)
6✔
86
      return "-current" if controller_name == "review_and_submit"
108✔
87
      if step4_valid?
80✔
88
        "-completed"
×
89
      else
90
        "-incomplete"
80✔
91
      end
92
    end
93

94
    def step1_valid?
6✔
95
      return false if request.project_title.blank? || request.project_folder.blank? || request.project_purpose.blank? || request.description.blank? || request.departments.blank?
224✔
96
      true
66✔
97
    end
98

99
    def step2_valid?
6✔
100
      return false if request.data_manager.blank? || request.data_sponsor.blank?
104✔
101
      true
20✔
102
    end
103

104
    def step3_valid?
6✔
105
      return false if request.storage_size.nil?
102✔
106
      true
18✔
107
    end
108

109
    def step4_valid?
6✔
110
      step1_valid? && step2_valid? && step3_valid?
80✔
111
    end
112
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