1
0

annual_reports_presenter.rb 561 B

1234567891011121314151617181920212223
  1. # frozen_string_literal: true
  2. class AnnualReportsPresenter
  3. alias read_attribute_for_serialization send
  4. attr_reader :annual_reports
  5. def initialize(annual_reports)
  6. @annual_reports = annual_reports
  7. end
  8. def accounts
  9. @accounts ||= Account.where(id: @annual_reports.flat_map(&:account_ids)).includes(:account_stat, :moved_to_account, user: :role)
  10. end
  11. def statuses
  12. @statuses ||= Status.where(id: @annual_reports.flat_map(&:status_ids)).with_includes
  13. end
  14. def self.model_name
  15. @model_name ||= ActiveModel::Name.new(self)
  16. end
  17. end