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

pulibrary / tigerdata-app / 28b04e17-7ce0-43d4-9c8a-852b96fa09c4

22 Oct 2025 08:18PM UTC coverage: 86.978% (-4.2%) from 91.178%
28b04e17-7ce0-43d4-9c8a-852b96fa09c4

Pull #2084

circleci

bess
Clarify that mediaflux no longer needs separate startup for local dev
Pull Request #2084: Clarify that mediaflux no longer needs separate startup for local development

2625 of 3018 relevant lines covered (86.98%)

271.32 hits per line

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

52.08
/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
    if current_user.eligible_sysadmin?
×
8
      add_breadcrumb("Project Requests - All")
×
9
      @draft_requests = Request.where(state: Request::DRAFT).map do |request|
×
10
        request.project_title = "no title set" if request.project_title.blank?
×
11
        request
×
12
      end
13
      @submitted_requests = Request.where(state: Request::SUBMITTED)
×
14
    else
15
      error_message = "You do not have access to this page."
×
16
      flash[:notice] = error_message
×
17
      redirect_to dashboard_path
×
18
    end
19
  end
20

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

35
  # rubocop:disable Metrics/AbcSize
36
  # rubocop:disable Metrics/MethodLength
37
  # rubocop:disable Metrics/PerceivedComplexity
38
  # rubocop:disable Metrics/CyclomaticComplexity
39
  def approve
1✔
40
    if eligible_to_approve
11✔
41
      @request_model = Request.find(params[:id])
6✔
42
      if @request_model.valid_to_submit?
6✔
43
        project = @request_model.approve(current_user)
6✔
44
        @request_model.destroy!
4✔
45
        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✔
46
        TigerdataMailer.with(project_id: project.id, approver: current_user).project_creation.deliver_later
4✔
47
        redirect_to project_path(project.id), notice: stub_message
4✔
48
      else
49
        redirect_to new_project_review_and_submit_path(@request_model)
×
50
      end
51
    else
52
      error_message = "You do not have access to this page."
5✔
53
      flash[:notice] = error_message
5✔
54
      redirect_to dashboard_path
5✔
55
    end
56
  rescue StandardError => ex
57
    if ex.is_a?(Mediaflux::SessionExpired) || ex.cause.is_a?(Mediaflux::SessionExpired)
2✔
58
      raise
1✔
59
    elsif ex.is_a?(ProjectCreate::ProjectCreateError) && ex.message.include?("Session expired for token")
1✔
60
      raise Mediaflux::SessionExpired
1✔
61
    else
62
      Rails.logger.error "Error approving request #{params[:id]}. Details: #{ex.message}"
×
63
      Honeybadger.notify "Error approving request #{params[:id]}. Details: #{ex.message}"
×
64
      flash[:notice] = "Error approving request #{params[:id]}"
×
65
      redirect_to request_path(@request_model)
×
66
    end
67
  end
68
  # rubocop:enable Metrics/MethodLength
69
  # rubocop:enable Metrics/AbcSize
70
  # rubocop:enable Metrics/PerceivedComplexity
71
  # rubocop:enable Metrics/CyclomaticComplexity
72

73
  private
1✔
74

75
    def set_breadcrumbs
1✔
76
      add_breadcrumb("Dashboard", dashboard_path)
11✔
77
    end
78

79
    def eligible_to_approve
1✔
80
      current_user.sysadmin || (current_user.developer && !Rails.env.production?)
11✔
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