Class: Krikri::ReportsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/krikri/reports_controller.rb

Overview

Handles HTTP requests for the Reports dashboard, presenting all types of reports, filtered by Provider if given.

Instance Method Summary collapse

Instance Method Details

#indexObject

Renders the index view, giving ‘@validation_reports` and `@qa_reports` for the specified provider.



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/krikri/reports_controller.rb', line 11

def index
  @current_provider = params[:provider]
  report = Krikri::ValidationReport.new
  report.provider_id = @current_provider
  @validation_reports = report.all

  if @current_provider
    @provider = Krikri::Provider.find(@current_provider)
    @qa_reports = Array(Krikri::QAReport.find_by(provider: @current_provider))
  else
    @qa_reports = Krikri::QAReport.all
  end
end