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

pulibrary / tigerdata-app / bb6442c4-eb43-430c-9683-6ffb5848882a

21 Oct 2025 08:43PM UTC coverage: 87.325% (+0.4%) from 86.877%
bb6442c4-eb43-430c-9683-6ffb5848882a

Pull #2066

circleci

bess
Stop mediaflux when we stop everything else
Pull Request #2066: Stop mediaflux when we stop everything else

2625 of 3006 relevant lines covered (87.33%)

307.22 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
63✔
6
  end
7

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

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

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

25
  def full_name(uid)
4✔
26
    return "" if uid.blank?
22✔
27
    user = User.find_by(uid: uid)
20✔
28
    user.display_name_safe.to_s
20✔
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
260✔
35
    case step
260✔
36
    when 1
37
      step1_css_suffix(controller_name, substep)
104✔
38
    when 2
39
      step2_css_suffix(controller_name)
52✔
40
    when 3
41
      step3_css_suffix(controller_name)
52✔
42
    when 4
43
      step4_css_suffix(controller_name)
52✔
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"
104✔
53
      if substep.nil?
104✔
54
        return "-current" if controller_name.start_with?("project_information")
52✔
55
        if step1_valid?
33✔
56
          css_suffix = "-completed"
12✔
57
        end
58
      elsif substep == "Basic Details"
52✔
59
        return "-current" if controller_name == "project_information"
52✔
60
        if step1_valid?
35✔
61
          css_suffix = "-completed"
12✔
62
        end
63
      end
64
      css_suffix
68✔
65
    end
66

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

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

85
    def step4_css_suffix(controller_name)
4✔
86
      return "-current" if controller_name == "review_and_submit"
52✔
87
      if step4_valid?
39✔
88
        "-completed"
×
89
      else
90
        "-incomplete"
39✔
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?
107✔
96
      true
33✔
97
    end
98

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

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

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