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

pulibrary / tigerdata-app / 8d70f2ab-acc5-4aab-b64b-743d66ddd2eb

29 Aug 2025 06:22PM UTC coverage: 87.983% (-0.1%) from 88.118%
8d70f2ab-acc5-4aab-b64b-743d66ddd2eb

Pull #1801

circleci

JaymeeH
Merge branch '1586-request-mailer' of https://github.com/pulibrary/tiger-data-app into 1586-request-mailer
Pull Request #1801: 1586 request mailer

10 of 10 new or added lines in 2 files covered. (100.0%)

1173 existing lines in 56 files now uncovered.

2482 of 2821 relevant lines covered (87.98%)

317.98 hits per line

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

88.1
/app/controllers/users_controller.rb
1
# frozen_string_literal: true
UNCOV
2
class UsersController < ApplicationController
1✔
UNCOV
3
  before_action :set_breadcrumbs
1✔
UNCOV
4
  before_action :check_user_access
1✔
5

UNCOV
6
  def index
1✔
UNCOV
7
    @users = User.order("uid ASC NULLS LAST").page params[:page]
3✔
UNCOV
8
  end
9

UNCOV
10
  def show
1✔
UNCOV
11
    add_breadcrumb("User")
3✔
UNCOV
12
    @user = User.find(params[:id])
3✔
UNCOV
13
  end
14

UNCOV
15
  def edit
1✔
UNCOV
16
    add_breadcrumb("Edit User")
1✔
UNCOV
17
    @user = User.find(params[:id])
1✔
UNCOV
18
  end
19

UNCOV
20
  def update
1✔
UNCOV
21
    update_user_with_params
1✔
UNCOV
22
    redirect_to user_path(@user)
1✔
UNCOV
23
  rescue => ex
24
    short_message = "Error saving user #{params[:id]}"
×
25
    Rails.logger.error "#{short_message}: #{ex.message}"
×
26
    Honeybadger.notify "#{short_message}: #{ex.message}"
×
27
    flash[:alert] = short_message
×
28
    redirect_to user_path(id: params[:id])
×
UNCOV
29
  end
30

UNCOV
31
  def lookup
1✔
UNCOV
32
    query = (params["query"] || "").strip.downcase
6✔
UNCOV
33
    matches = PrincetonUsers.user_list_query(query)
6✔
UNCOV
34
    result = {
UNCOV
35
      suggestions: matches.take(20).map { |match| { "value": match[:name] || "", "data": match[:uid] } }
12✔
UNCOV
36
    }
UNCOV
37
    render json: result
6✔
UNCOV
38
  end
39

UNCOV
40
  private
1✔
41

UNCOV
42
    def set_breadcrumbs
1✔
UNCOV
43
      add_breadcrumb("Users", users_path)
18✔
UNCOV
44
    end
45

UNCOV
46
    def check_user_access
1✔
UNCOV
47
      return if current_user.superuser || current_user.sysadmin || current_user.trainer
18✔
UNCOV
48
      flash[:notice] = "You do not have access to this page (#{current_user.uid})"
4✔
UNCOV
49
      redirect_to dashboard_path
4✔
UNCOV
50
    end
51

52
    # rubocop:disable Metrics/AbcSize
UNCOV
53
    def update_user_with_params
1✔
UNCOV
54
      @user = User.find(params[:id])
1✔
UNCOV
55
      @user.given_name = params["user"]["given_name"]
1✔
UNCOV
56
      @user.family_name = params["user"]["family_name"]
1✔
UNCOV
57
      @user.display_name = params["user"]["display_name"]
1✔
UNCOV
58
      @user.eligible_sponsor = params["user"]["eligible_sponsor"] == "1"
1✔
UNCOV
59
      @user.eligible_manager = params["user"]["eligible_manager"] == "1"
1✔
UNCOV
60
      @user.superuser = params["user"]["superuser"] == "1"
1✔
UNCOV
61
      @user.sysadmin = params["user"]["sysadmin"] == "1"
1✔
UNCOV
62
      @user.trainer = params["user"]["trainer"] == "1"
1✔
UNCOV
63
      @user.save!
1✔
UNCOV
64
    end
65
  # rubocop:enable Metrics/AbcSize
UNCOV
66
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