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

pulibrary / tigerdata-app / 49abd256-27e3-45e4-a672-bbe75194bd67

04 Jun 2025 08:10PM UTC coverage: 85.735% (-0.2%) from 85.904%
49abd256-27e3-45e4-a672-bbe75194bd67

Pull #1538

circleci

bess
Configure database for CI
Pull Request #1538: Deploy to ci server

4 of 4 branches covered (100.0%)

2891 of 3372 relevant lines covered (85.74%)

495.86 hits per line

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

81.58
/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
      @requests = Request.all
2✔
11
    else
12
      error_message = "You do not have access to this page."
3✔
13
      flash[:notice] = error_message
3✔
14
      redirect_to dashboard_path
3✔
15
    end
16
  end
17

18
  def show
1✔
19
    if current_user.superuser || current_user.sysadmin || current_user.trainer
7✔
20
      @request = Request.find(params[:id])
4✔
21
      add_breadcrumb("Requests", requests_path)
4✔
22
      add_breadcrumb(@request.project_title, request_path)
4✔
23
      render :show
4✔
24
    else
25
      error_message = "You do not have access to this page."
3✔
26
      flash[:notice] = error_message
3✔
27
      redirect_to dashboard_path
3✔
28
    end
29
  end
30

31
  def approve
1✔
32
    if current_user.superuser || current_user.sysadmin || current_user.trainer
2✔
33
      @request = Request.find(params[:id])
2✔
34
      project_metadata_json = RequestProjectMetadata.convert(@request)
2✔
35
      project = Project.create!({ metadata_json: project_metadata_json })
2✔
36
      @request.destroy
2✔
37
      stub_message = "Project approved and created in the TigerData web portal; request has been processed and deleted"
2✔
38
      redirect_to project_path(project.id), notice: stub_message
2✔
39
    else
40
      error_message = "You do not have access to this page."
×
41
      flash[:notice] = error_message
×
42
      redirect_to dashboard_path
×
43
    end
44
  end
45

46
  private
1✔
47

48
    # rubocop:disable Metrics/MethodLength
49
    def parse_request_metadata(request)
1✔
50
      project_directory = "/tigerdata/#{request[:parent_folder]}/#{request[:project_folder]}"
×
51
      departments = request[:departments].map { |d| d["name"] }
×
52
      data_users = request[:user_roles].map { |u| u["uid"] }
×
53
      {
54
        title: request[:project_title],
×
55
        description: request[:description],
56
        status: Project::APPROVED_STATUS,
57
        data_sponsor: request[:data_sponsor],
58
        data_manager: request[:data_manager],
59
        departments: departments,
60
        data_user_read_only: data_users,
61
        project_directory: project_directory,
62
        storage_capacity: {
63
          size: {
64
            approved: request[:quota].split(" ").first,
65
            requested: request[:quota].split(" ").first
66
          },
67
          unit: {
68
            approved: request[:storage_unit],
69
            requested: request[:storage_unit]
70
          }
71
        },
72
        storage_performance_expectations: { requested: "Standard", approved: "Standard" },
73
        created_by: nil,
74
        created_on: request[:created_at]
75
      }
76
    end
77
    # rubocop:enable Metrics/MethodLength
78

79
    def set_breadcrumbs
1✔
80
      add_breadcrumb("Dashboard", dashboard_path)
14✔
81
    end
82
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