app/models/decidim/plans/plan.rb in decidim-plans-0.16.0 vs app/models/decidim/plans/plan.rb in decidim-plans-0.16.1

- old
+ new

@@ -97,10 +97,17 @@ # Returns Boolean. def published? published_at.present? end + # Public: Checks if the plan has been closed or not. + # + # Returns Boolean. + def closed? + closed_at.present? + end + # Public: Checks if the organization has given an answer for the plan. # # Returns Boolean. def answered? answered_at.present? && state.present? @@ -187,9 +194,17 @@ AND decidim_comments_comments.decidim_commentable_type = 'Decidim::Plans::Plan' GROUP BY decidim_comments_comments.decidim_commentable_id ) SQL Arel.sql(query) + end + + def self.export_serializer + Decidim::Plans::PlanSerializer + end + + def self.data_portability_images(user) + user_collection(user).map { |p| p.attachments.collect(&:file) } end # Checks whether the plan is inside the time window to be editable or not once published. def within_edit_time_limit? true