Class: Krikri::QaReportsController

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

Overview

Handles HTTP requests for QA Reports

See Also:

Instance Method Summary collapse

Instance Method Details

#indexObject

Renders a list of current reports



9
10
11
# File 'app/controllers/krikri/qa_reports_controller.rb', line 9

def index
  @reports = Krikri::QAReport.all
end

#showObject

Rendering the report as either a full ‘field` report or a `count` report.

Responds to format of ‘text/csv` with a CSV rendering of the requested report type.



18
19
20
21
22
23
24
25
26
# File 'app/controllers/krikri/qa_reports_controller.rb', line 18

def show
  @report = Krikri::QAReport.find(params[:id])
  @type = params[:type] == 'count' ? :count : :field

  respond_to do |format|
    format.html
    format.csv { render text: @report.send("#{@type}_csv".to_sym).to_csv }
  end
end