Add year in review feature to web UI (#32709)
This commit is contained in:
parent
20a147170e
commit
d6349c0e9a
38 changed files with 1103 additions and 21 deletions
9
app/serializers/rest/annual_report_event_serializer.rb
Normal file
9
app/serializers/rest/annual_report_event_serializer.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class REST::AnnualReportEventSerializer < ActiveModel::Serializer
|
||||
attributes :year
|
||||
|
||||
def year
|
||||
object.year.to_s
|
||||
end
|
||||
end
|
|
@ -13,6 +13,7 @@ class REST::NotificationGroupSerializer < ActiveModel::Serializer
|
|||
belongs_to :report, if: :report_type?, serializer: REST::ReportSerializer
|
||||
belongs_to :account_relationship_severance_event, key: :event, if: :relationship_severance_event?, serializer: REST::AccountRelationshipSeveranceEventSerializer
|
||||
belongs_to :account_warning, key: :moderation_warning, if: :moderation_warning_event?, serializer: REST::AccountWarningSerializer
|
||||
belongs_to :generated_annual_report, key: :annual_report, if: :annual_report_event?, serializer: REST::AnnualReportEventSerializer
|
||||
|
||||
def sample_account_ids
|
||||
object.sample_accounts.pluck(:id).map(&:to_s)
|
||||
|
@ -38,6 +39,10 @@ class REST::NotificationGroupSerializer < ActiveModel::Serializer
|
|||
object.type == :moderation_warning
|
||||
end
|
||||
|
||||
def annual_report_event?
|
||||
object.type == :annual_report
|
||||
end
|
||||
|
||||
def page_min_id
|
||||
object.pagination_data[:min_id].to_s
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue