You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
561 B
24 lines
561 B
10 months ago
|
# frozen_string_literal: true
|
||
|
|
||
|
class AnnualReportsPresenter
|
||
|
alias read_attribute_for_serialization send
|
||
|
|
||
|
attr_reader :annual_reports
|
||
|
|
||
|
def initialize(annual_reports)
|
||
|
@annual_reports = annual_reports
|
||
|
end
|
||
|
|
||
|
def accounts
|
||
|
@accounts ||= Account.where(id: @annual_reports.flat_map(&:account_ids)).includes(:account_stat, :moved_to_account, user: :role)
|
||
|
end
|
||
|
|
||
|
def statuses
|
||
|
@statuses ||= Status.where(id: @annual_reports.flat_map(&:status_ids)).with_includes
|
||
|
end
|
||
|
|
||
|
def self.model_name
|
||
|
@model_name ||= ActiveModel::Name.new(self)
|
||
|
end
|
||
|
end
|