Add annual reports for accounts (#28693)
This commit is contained in:
parent
01ce9df880
commit
5b1eb09d54
21 changed files with 480 additions and 1 deletions
23
app/presenters/annual_reports_presenter.rb
Normal file
23
app/presenters/annual_reports_presenter.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
# 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
|
Loading…
Add table
Add a link
Reference in a new issue