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

pulibrary / tigerdata-app / 9d76b7eb-940a-44e8-b4ac-cf7b8cdcc98c

01 Dec 2025 03:02PM UTC coverage: 80.707% (-6.9%) from 87.594%
9d76b7eb-940a-44e8-b4ac-cf7b8cdcc98c

Pull #2251

circleci

carolyncole
Updating the department select to utilize LuxInputMultiSelect
The component only allows an item to be selected once (only for non asynch results which departments are).
fiexs #2134
Pull Request #2251: Updating the department select to utilize LuxInputMultiSelect

2602 of 3224 relevant lines covered (80.71%)

263.99 hits per line

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

86.42
/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
47✔
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 project_directory
3✔
26
    request.parent_folder.present? ? File.join(request.parent_folder, request.project_folder) : request.project_folder
×
27
  end
28

29
  def project_purpose
3✔
30
    ProjectPurpose.label_for(request.project_purpose)
×
31
  end
32

33
  def departments_list
3✔
34
    return "" if request.departments.blank?
2✔
35
    dept_list = []
1✔
36
    request.departments.each do |dept|
1✔
37
      dept_list << "#{dept['name']} (#{dept['code']})"
2✔
38
    end
39
    dept_list.join(", ")
1✔
40
  end
41

42
  def user_list
3✔
43
    return "" if request.user_roles.blank?
2✔
44
    usr_list = []
1✔
45
    request.user_roles.each do |usr|
1✔
46
      name = full_name(usr["uid"])
2✔
47
      name += " read only" if usr["read_only"]
2✔
48
      usr_list << name
2✔
49
    end
50
    usr_list.join(", ")
1✔
51
  end
52

53
  def full_name(uid)
3✔
54
    return "" if uid.blank?
8✔
55
    user = User.find_by(uid: uid)
6✔
56
    user.display_name_safe.to_s
6✔
57
  end
58

59
  # Returns the correct CSS class suffix for the sidebar navigation progress for a given
60
  # step/substep.
61
  def sidebar_progress(controller, step, substep = nil)
3✔
62
    controller_name = controller.controller_name
40✔
63
    case step
40✔
64
    when 1
65
      step1_css_suffix(controller_name, substep)
16✔
66
    when 2
67
      step2_css_suffix(controller_name)
8✔
68
    when 3
69
      step3_css_suffix(controller_name)
8✔
70
    when 4
71
      step4_css_suffix(controller_name)
8✔
72
    else
73
      "-incomplete"
×
74
    end
75
  end
76

77
  private
3✔
78

79
    def step1_css_suffix(controller_name, substep = nil)
3✔
80
      css_suffix = "-incomplete"
16✔
81
      if substep.nil?
16✔
82
        return "-current" if controller_name.start_with?("project_information")
8✔
83
        if step1_valid?
4✔
84
          css_suffix = "-completed"
×
85
        end
86
      elsif substep == "Basic Details"
8✔
87
        return "-current" if controller_name == "project_information"
8✔
88
        if step1_valid?
6✔
89
          css_suffix = "-completed"
×
90
        end
91
      end
92
      css_suffix
10✔
93
    end
94

95
    def step2_css_suffix(controller_name)
3✔
96
      return "-current" if controller_name == "roles_and_people"
8✔
97
      if step2_valid?
7✔
98
        "-completed"
×
99
      else
100
        "-incomplete"
7✔
101
      end
102
    end
103

104
    def step3_css_suffix(controller_name)
3✔
105
      return "-current" if controller_name == "storage_and_access"
8✔
106
      if step3_valid?
8✔
107
        "-completed"
×
108
      else
109
        "-incomplete"
8✔
110
      end
111
    end
112

113
    def step4_css_suffix(controller_name)
3✔
114
      return "-current" if controller_name == "review_and_submit"
8✔
115
      if step4_valid?
8✔
116
        "-completed"
×
117
      else
118
        "-incomplete"
8✔
119
      end
120
    end
121

122
    def step1_valid?
3✔
123
      return false if request.project_title.blank? || request.project_folder.blank? || request.project_purpose.blank? || request.description.blank? || request.departments.blank?
18✔
124
      true
×
125
    end
126

127
    def step2_valid?
3✔
128
      return false if request.data_manager.blank? || request.data_sponsor.blank?
7✔
129
      true
×
130
    end
131

132
    def step3_valid?
3✔
133
      return false if request.storage_size.nil?
8✔
134
      true
×
135
    end
136

137
    def step4_valid?
3✔
138
      step1_valid? && step2_valid? && step3_valid?
8✔
139
    end
140
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