• 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

71.74
/app/controllers/requests_controller.rb
1
# frozen_string_literal: true
UNCOV
2
class RequestsController < ApplicationController
1✔
UNCOV
3
  before_action :set_breadcrumbs
1✔
4

5
  # GET /requests
UNCOV
6
  def index
1✔
UNCOV
7
    return head :forbidden unless Flipflop.new_project_request_wizard?
5✔
UNCOV
8
    if current_user.eligible_sysadmin?
5✔
UNCOV
9
      add_breadcrumb("Project Requests - All")
2✔
UNCOV
10
      @draft_requests = Request.where(state: Request::DRAFT).map do |request|
2✔
11
        request.project_title = "no title set" if request.project_title.blank?
×
12
        request
×
UNCOV
13
      end
UNCOV
14
      @submitted_requests = Request.where(state: Request::SUBMITTED)
2✔
UNCOV
15
    else
UNCOV
16
      error_message = "You do not have access to this page."
3✔
UNCOV
17
      flash[:notice] = error_message
3✔
UNCOV
18
      redirect_to dashboard_path
3✔
UNCOV
19
    end
UNCOV
20
  end
21

UNCOV
22
  def show
1✔
UNCOV
23
    if current_user.superuser || current_user.sysadmin || current_user.trainer
15✔
UNCOV
24
      @request_model = Request.find(params[:id])
11✔
UNCOV
25
      add_breadcrumb("Requests", requests_path)
11✔
UNCOV
26
      add_breadcrumb(@request_model.project_title, request_path(@request_model))
11✔
UNCOV
27
      render :show
11✔
UNCOV
28
    else
UNCOV
29
      error_message = "You do not have access to this page."
4✔
UNCOV
30
      flash[:notice] = error_message
4✔
UNCOV
31
      redirect_to dashboard_path
4✔
UNCOV
32
    end
UNCOV
33
  end
34

35
  # rubocop:disable Metrics/MethodLength
36
  # rubocop:disable Metrics/AbcSize
UNCOV
37
  def approve
1✔
UNCOV
38
    if current_user.superuser || current_user.sysadmin || current_user.trainer
5✔
UNCOV
39
      @request_model = Request.find(params[:id])
5✔
UNCOV
40
      if @request_model.valid_to_submit?
5✔
UNCOV
41
        project = @request_model.approve(current_user)
4✔
UNCOV
42
        @request_model.destroy
4✔
UNCOV
43
        stub_message = "The request has been approved and this project was created in the TigerData web portal.  The request has been processed and deleted."
4✔
UNCOV
44
        redirect_to project_path(project.id), notice: stub_message
4✔
UNCOV
45
      else
UNCOV
46
        redirect_to new_project_review_and_submit_path(@request_model)
1✔
UNCOV
47
      end
UNCOV
48
    else
49
      error_message = "You do not have access to this page."
×
50
      flash[:notice] = error_message
×
51
      redirect_to dashboard_path
×
UNCOV
52
    end
UNCOV
53
  rescue StandardError => ex
54
    Rails.logger.error "Error approving request #{params[:id]}. Details: #{ex.message}"
×
55
    Honeybadger.notify "Error approving request #{params[:id]}. Details: #{ex.message}"
×
56
    flash[:notice] = "Error approving request #{params[:id]}"
×
57
    redirect_to request_path(@request_model)
×
UNCOV
58
  end
59
  # rubocop:enable Metrics/AbcSize
60
  # rubocop:enable Metrics/MethodLength
61

UNCOV
62
  private
1✔
63

64
    # rubocop:disable Metrics/MethodLength
UNCOV
65
    def parse_request_metadata(request)
1✔
66
      project_directory = "/tigerdata/#{request[:parent_folder]}/#{request[:project_folder]}"
×
67
      departments = request[:departments].map { |d| d["name"] }
×
68
      data_users = request[:user_roles].map { |u| u["uid"] }
×
UNCOV
69
      {
70
        title: request[:project_title],
×
UNCOV
71
        description: request[:description],
UNCOV
72
        status: Project::APPROVED_STATUS,
UNCOV
73
        data_sponsor: request[:data_sponsor],
UNCOV
74
        data_manager: request[:data_manager],
UNCOV
75
        departments: departments,
UNCOV
76
        data_user_read_only: data_users,
UNCOV
77
        project_directory: project_directory,
UNCOV
78
        storage_capacity: {
UNCOV
79
          size: {
UNCOV
80
            approved: request[:quota].split(" ").first,
UNCOV
81
            requested: request[:quota].split(" ").first
UNCOV
82
          },
UNCOV
83
          unit: {
UNCOV
84
            approved: request[:storage_unit],
UNCOV
85
            requested: request[:storage_unit]
UNCOV
86
          }
UNCOV
87
        },
UNCOV
88
        storage_performance_expectations: { requested: "Standard", approved: "Standard" },
UNCOV
89
        created_by: nil,
UNCOV
90
        created_on: request[:created_at]
UNCOV
91
      }
UNCOV
92
    end
93
    # rubocop:enable Metrics/MethodLength
94

UNCOV
95
    def set_breadcrumbs
1✔
UNCOV
96
      add_breadcrumb("Dashboard", dashboard_path)
25✔
UNCOV
97
    end
UNCOV
98
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