rubyforgood/casa

View on GitHub
app/controllers/learning_hours_reports_controller.rb

Summary

Maintainability
A
20 mins
Test Coverage
A
100%
class LearningHoursReportsController < ApplicationController
  after_action :verify_authorized

  def index
    authorize :application, :see_reports_page?
    learning_hours_report = LearningHoursReport.new(current_organization.id)

    respond_to do |format|
      format.csv do
        send_data learning_hours_report.to_csv,
          filename: "learning-hours-report-#{Time.current.strftime("%Y-%m-%d")}.csv"
      end
    end
  end
end