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

pulibrary / tigerdata-app / eb2d2ee1-6984-4ba6-b630-cf50b23f06aa

18 Sep 2025 06:57PM UTC coverage: 88.651% (-0.3%) from 88.908%
eb2d2ee1-6984-4ba6-b630-cf50b23f06aa

Pull #1851

circleci

carolyncole
Fixing the javascript for multiple user select and transfer
Pull Request #1851: Adding the new data users table and move the old search into a popover

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

4 existing lines in 1 file now uncovered.

2531 of 2855 relevant lines covered (88.65%)

301.61 hits per line

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

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

5
  # GET /requests
6
  def index
1✔
7
    return head :forbidden unless Flipflop.new_project_request_wizard?
5✔
8
    if current_user.eligible_sysadmin?
5✔
9
      add_breadcrumb("Project Requests - All")
2✔
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
×
13
      end
14
      @submitted_requests = Request.where(state: Request::SUBMITTED)
2✔
15
    else
16
      error_message = "You do not have access to this page."
3✔
17
      flash[:notice] = error_message
3✔
18
      redirect_to dashboard_path
3✔
19
    end
20
  end
21

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

35
  # rubocop:disable Metrics/MethodLength
36
  # rubocop:disable Metrics/AbcSize
37
  def approve
1✔
38
    if current_user.developer || current_user.sysadmin || current_user.trainer
5✔
39
      @request_model = Request.find(params[:id])
5✔
40
      if @request_model.valid_to_submit?
5✔
41
        project = @request_model.approve(current_user)
4✔
42
        @request_model.destroy
4✔
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✔
44
        TigerdataMailer.with(project_id: project.id, approver: current_user).project_creation.deliver_later
4✔
45
        redirect_to project_path(project.id), notice: stub_message
4✔
46
      else
47
        redirect_to new_project_review_and_submit_path(@request_model)
1✔
48
      end
49
    else
50
      error_message = "You do not have access to this page."
×
51
      flash[:notice] = error_message
×
52
      redirect_to dashboard_path
×
53
    end
54
  rescue StandardError => ex
55
    Rails.logger.error "Error approving request #{params[:id]}. Details: #{ex.message}"
×
56
    Honeybadger.notify "Error approving request #{params[:id]}. Details: #{ex.message}"
×
57
    flash[:notice] = "Error approving request #{params[:id]}"
×
58
    redirect_to request_path(@request_model)
×
59
  end
60
  # rubocop:enable Metrics/AbcSize
61
  # rubocop:enable Metrics/MethodLength
62

63
  private
1✔
64

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

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