Sha256: e0378a08bb072d91c112409cad1663c7fc1825ab01705f9e2dfb9dd1f188d2ee

Contents?: true

Size: 809 Bytes

Versions: 6

Compression:

Stored size: 809 Bytes

Contents

# frozen_string_literal: true

namespace :decidim_meetings do
  # For privacy reasons we recommend that you delete this registration form when you no longer need it.
  # By default this is 3 months after the meeting has passed
  desc "Removes registration forms belonging to meetings that have ended more than X months ago"
  task :clean_registration_forms, [:months] => :environment do |_t, args|
    args.with_defaults(months: 3)

    query = Decidim::Meetings::Meeting.arel_table[:end_time].lteq(Time.current - args[:months].months)
    old_meeting_ids = Decidim::Meetings::Meeting.where(query).pluck(:id)
    old_questionnaires = Decidim::Forms::Questionnaire.where(questionnaire_for_type: "Decidim::Meetings::Meeting", questionnaire_for_id: old_meeting_ids)

    old_questionnaires.destroy_all
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-meetings-0.29.1 lib/tasks/decidim_meetings.rake
decidim-meetings-0.29.0 lib/tasks/decidim_meetings.rake
decidim-meetings-0.29.0.rc4 lib/tasks/decidim_meetings.rake
decidim-meetings-0.29.0.rc3 lib/tasks/decidim_meetings.rake
decidim-meetings-0.29.0.rc2 lib/tasks/decidim_meetings.rake
decidim-meetings-0.29.0.rc1 lib/tasks/decidim_meetings.rake