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

pulibrary / tigerdata-app / 58384df5-4328-40b4-9cad-0ff5f77cb960

27 Oct 2025 02:45PM UTC coverage: 91.291%. Remained the same
58384df5-4328-40b4-9cad-0ff5f77cb960

push

circleci

web-flow
Place the file path on its own line on the project dashboard (#2097)

Co-authored-by: Hector Correa <hector_correa@princeton.edu>

2757 of 3020 relevant lines covered (91.29%)

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

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

17
  def data_sponsor
5✔
18
    full_name(request.data_sponsor)
26✔
19
  end
20

21
  def data_manager
5✔
22
    full_name(request.data_manager)
28✔
23
  end
24

25
  def full_name(uid)
5✔
26
    return "" if uid.blank?
60✔
27
    user = User.find_by(uid: uid)
52✔
28
    user.display_name_safe.to_s
52✔
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)
5✔
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
5✔
50

51
    def step1_css_suffix(controller_name, substep = nil)
5✔
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)
5✔
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)
5✔
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)
5✔
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?
5✔
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?
5✔
100
      return false if request.data_manager.blank? || request.data_sponsor.blank?
104✔
101
      true
20✔
102
    end
103

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

109
    def step4_valid?
5✔
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