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

pulibrary / tigerdata-app / a3f50227-2424-4d41-8788-b953b9d6c802

24 Nov 2025 05:22PM UTC coverage: 70.412% (-17.7%) from 88.064%
a3f50227-2424-4d41-8788-b953b9d6c802

push

circleci

web-flow
Deduplicate department field from requests (#2229)

ref #2147

1 of 4 new or added lines in 1 file covered. (25.0%)

833 existing lines in 48 files now uncovered.

2344 of 3329 relevant lines covered (70.41%)

150.39 hits per line

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

0.0
/app/services/user_error_parser.rb
1
# frozen_string_literal: true
UNCOV
2
class UserErrorParser
×
UNCOV
3
  class << self
×
UNCOV
4
    def csv_users(errors_str)
×
UNCOV
5
      users = parse(errors_str)
×
UNCOV
6
      "uid,email,given_name,family_name,display_name,eligible_sponsor," \
×
UNCOV
7
      "eligible_manager,developer,sysadmin,tester_trainer,DateAdded,AddedBy,Notes\n" \
×
UNCOV
8
      "#{users.join("\n")}"
×
UNCOV
9
    end
×
10

UNCOV
11
    def parse(errors_str)
×
UNCOV
12
      errors = errors_str.split("\n")
×
UNCOV
13
      roles = errors.map { |error| parse_line(error) }.flatten
×
UNCOV
14
      user_roles = roles.group_by { |role| role[:uid] }
×
UNCOV
15
      user_roles.map do |uid, user_role|
×
UNCOV
16
        "#{uid},,,,,#{sponsor_flag(user_role)},#{manager_flag(user_role)},,,,#{report_date},ImportProcess,\"Capacity Early Adopter\""
×
UNCOV
17
      end
×
UNCOV
18
    end
×
19

UNCOV
20
      private
×
21

UNCOV
22
        def parse_line(error)
×
UNCOV
23
          error_messages = error.split(";")
×
UNCOV
24
          error_messages.map do |str|
×
UNCOV
25
            user_role = str.split(":").last
×
UNCOV
26
            parts = user_role.split(" for role ")
×
UNCOV
27
            uid = parts.first
×
UNCOV
28
            role = parts.last
×
UNCOV
29
            { uid: uid.strip, role: role.strip }
×
UNCOV
30
          end
×
UNCOV
31
        end
×
32

UNCOV
33
        def report_date
×
UNCOV
34
          Time.current.in_time_zone("America/New_York").strftime("%Y-%m-%d")
×
UNCOV
35
        end
×
36

UNCOV
37
        def sponsor_flag(roles)
×
UNCOV
38
          if roles.count { |data| data[:role] == "Data Sponsor" }.positive?
×
UNCOV
39
            "TRUE"
×
UNCOV
40
          else
×
UNCOV
41
            ""
×
UNCOV
42
          end
×
UNCOV
43
        end
×
44

UNCOV
45
        def manager_flag(roles)
×
UNCOV
46
          if roles.count { |data| data[:role] == "Data Manager" }.positive?
×
UNCOV
47
            "TRUE"
×
UNCOV
48
          else
×
UNCOV
49
            ""
×
UNCOV
50
          end
×
UNCOV
51
        end
×
UNCOV
52
  end
×
UNCOV
53
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