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

pulibrary / tigerdata-app / b095c537-f6ee-4593-8b3c-75df8560c192

21 Oct 2025 05:18PM UTC coverage: 86.987% (-4.2%) from 91.184%
b095c537-f6ee-4593-8b3c-75df8560c192

Pull #2048

circleci

web-flow
Merge branch 'main' into 1992-Startup_screen
Pull Request #2048: Adds startup screen for users with no projects

2627 of 3020 relevant lines covered (86.99%)

270.06 hits per line

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

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

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

17
  def data_sponsor
3✔
18
    full_name(request.data_sponsor)
1✔
19
  end
20

21
  def data_manager
3✔
22
    full_name(request.data_manager)
2✔
23
  end
24

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

49
  private
3✔
50

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

67
    def step2_css_suffix(controller_name)
3✔
68
      return "-current" if controller_name == "roles_and_people"
12✔
69
      if step2_valid?
11✔
70
        "-completed"
×
71
      else
72
        "-incomplete"
11✔
73
      end
74
    end
75

76
    def step3_css_suffix(controller_name)
3✔
77
      return "-current" if controller_name == "storage_and_access"
12✔
78
      if step3_valid?
11✔
79
        "-completed"
×
80
      else
81
        "-incomplete"
11✔
82
      end
83
    end
84

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

94
    def step1_valid?
3✔
95
      return false if request.project_title.blank? || request.project_folder.blank? || request.project_purpose.blank? || request.description.blank? || request.departments.blank?
28✔
96
      true
×
97
    end
98

99
    def step2_valid?
3✔
100
      return false if request.data_manager.blank? || request.data_sponsor.blank?
11✔
101
      true
×
102
    end
103

104
    def step3_valid?
3✔
105
      return false if request.storage_size.nil?
11✔
106
      true
×
107
    end
108

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