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

pulibrary / tigerdata-app / 529f7cba-0651-41c2-9045-ff17f0a5a349

21 Oct 2025 09:43PM UTC coverage: 86.877%. Remained the same
529f7cba-0651-41c2-9045-ff17f0a5a349

Pull #2070

circleci

bess
Remove tests for special production behavior
Pull Request #2070: Remove tests for special behavior in production

2615 of 3010 relevant lines covered (86.88%)

340.18 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
4✔
3
  attr_reader :request
4✔
4
  def initialize(request)
4✔
5
    @request = request
91✔
6
  end
7

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

17
  def data_sponsor
4✔
18
    full_name(request.data_sponsor)
12✔
19
  end
20

21
  def data_manager
4✔
22
    full_name(request.data_manager)
13✔
23
  end
24

25
  def full_name(uid)
4✔
26
    return "" if uid.blank?
28✔
27
    user = User.find_by(uid: uid)
24✔
28
    user.display_name_safe.to_s
24✔
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)
4✔
34
    controller_name = controller.controller_name
255✔
35
    case step
255✔
36
    when 1
37
      step1_css_suffix(controller_name, substep)
102✔
38
    when 2
39
      step2_css_suffix(controller_name)
51✔
40
    when 3
41
      step3_css_suffix(controller_name)
51✔
42
    when 4
43
      step4_css_suffix(controller_name)
51✔
44
    else
45
      "-incomplete"
×
46
    end
47
  end
48

49
  private
4✔
50

51
    def step1_css_suffix(controller_name, substep = nil)
4✔
52
      css_suffix = "-incomplete"
102✔
53
      if substep.nil?
102✔
54
        return "-current" if controller_name.start_with?("project_information")
51✔
55
        if step1_valid?
32✔
56
          css_suffix = "-completed"
12✔
57
        end
58
      elsif substep == "Basic Details"
51✔
59
        return "-current" if controller_name == "project_information"
51✔
60
        if step1_valid?
34✔
61
          css_suffix = "-completed"
12✔
62
        end
63
      end
64
      css_suffix
66✔
65
    end
66

67
    def step2_css_suffix(controller_name)
4✔
68
      return "-current" if controller_name == "roles_and_people"
51✔
69
      if step2_valid?
40✔
70
        "-completed"
7✔
71
      else
72
        "-incomplete"
33✔
73
      end
74
    end
75

76
    def step3_css_suffix(controller_name)
4✔
77
      return "-current" if controller_name == "storage_and_access"
51✔
78
      if step3_valid?
45✔
79
        "-completed"
9✔
80
      else
81
        "-incomplete"
36✔
82
      end
83
    end
84

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

94
    def step1_valid?
4✔
95
      return false if request.project_title.blank? || request.project_folder.blank? || request.project_purpose.blank? || request.description.blank? || request.departments.blank?
104✔
96
      true
33✔
97
    end
98

99
    def step2_valid?
4✔
100
      return false if request.data_manager.blank? || request.data_sponsor.blank?
49✔
101
      true
10✔
102
    end
103

104
    def step3_valid?
4✔
105
      return false if request.storage_size.nil?
48✔
106
      true
9✔
107
    end
108

109
    def step4_valid?
4✔
110
      step1_valid? && step2_valid? && step3_valid?
38✔
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