Sha256: 839a386704f5e056d7378cb6bb10298b99e1028e47c5a9b07376ede4c2c6cf0d

Contents?: true

Size: 808 Bytes

Versions: 53

Compression:

Stored size: 808 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 "Remove 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

53 entries across 53 versions & 1 rubygems

Version Path
decidim-meetings-0.28.4 lib/tasks/decidim_meetings.rake
decidim-meetings-0.27.9 lib/tasks/decidim_meetings.rake
decidim-meetings-0.28.3 lib/tasks/decidim_meetings.rake
decidim-meetings-0.27.8 lib/tasks/decidim_meetings.rake
decidim-meetings-0.28.2 lib/tasks/decidim_meetings.rake
decidim-meetings-0.27.7 lib/tasks/decidim_meetings.rake
decidim-meetings-0.28.1 lib/tasks/decidim_meetings.rake
decidim-meetings-0.27.6 lib/tasks/decidim_meetings.rake
decidim-meetings-0.26.10 lib/tasks/decidim_meetings.rake
decidim-meetings-0.26.9 lib/tasks/decidim_meetings.rake
decidim-meetings-0.28.0 lib/tasks/decidim_meetings.rake
decidim-meetings-0.27.5 lib/tasks/decidim_meetings.rake
decidim-meetings-0.28.0.rc5 lib/tasks/decidim_meetings.rake
decidim-meetings-0.28.0.rc4 lib/tasks/decidim_meetings.rake
decidim-meetings-0.26.8 lib/tasks/decidim_meetings.rake
decidim-meetings-0.27.4 lib/tasks/decidim_meetings.rake
decidim-meetings-0.27.3 lib/tasks/decidim_meetings.rake
decidim-meetings-0.26.7 lib/tasks/decidim_meetings.rake
decidim-meetings-0.26.5 lib/tasks/decidim_meetings.rake
decidim-meetings-0.27.2 lib/tasks/decidim_meetings.rake