Skip to content

Commit 347467a

Browse files
committed
Add needed decidim cron_jobs
1 parent 1d8334d commit 347467a

11 files changed

Lines changed: 137 additions & 2 deletions
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# frozen_string_literal: true
2+
3+
# Change active step in participatory processes
4+
class MetricsJob < CronJob
5+
self.cron_expression = '*/15 * * * *'
6+
7+
8+
def perform
9+
Rails.application.load_tasks
10+
Rake::Task['decidim_participatory_processes:change_active_step'].invoke
11+
12+
true
13+
end
14+
end
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# frozen_string_literal: true
2+
3+
# Compute metrics
4+
class MetricsJob < CronJob
5+
self.cron_expression = '1 0 * * *'
6+
7+
def perform
8+
Rails.application.load_tasks
9+
Rake::Task['decidim:metrics:all'].invoke
10+
11+
true
12+
end
13+
end
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# frozen_string_literal: true
2+
3+
# Compute open data
4+
5+
6+
class MetricsJob < CronJob
7+
self.cron_expression = '2 0 * * *'
8+
9+
def perform
10+
Rails.application.load_tasks
11+
Rake::Task['decidim:open_data:export'].invoke
12+
13+
true
14+
end
15+
end
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# frozen_string_literal: true
2+
3+
# Generate reminders
4+
5+
class MetricsJob < CronJob
6+
self.cron_expression = '4 0 * * *'
7+
8+
def perform
9+
Rails.application.load_tasks
10+
Rake::Task['decidim:reminders:all'].invoke
11+
12+
true
13+
end
14+
end
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# frozen_string_literal: true
2+
3+
# Checks validating initiatives and moves all without changes for a configured time to discarded state
4+
class MetricsJob < CronJob
5+
self.cron_expression = '0 7 * * * '
6+
7+
def perform
8+
Rails.application.load_tasks
9+
Rake::Task['decidim_initiatives:check_validating'].invoke
10+
11+
true
12+
end
13+
end
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# frozen_string_literal: true
2+
3+
# Notifies progress on published initiatives
4+
class MetricsJob < CronJob
5+
self.cron_expression = '0 8 * * *'
6+
7+
def perform
8+
Rails.application.load_tasks
9+
Rake::Task['decidim_initiatives:notify_progress'].invoke
10+
11+
true
12+
end
13+
end
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# frozen_string_literal: true
2+
3+
# Checks published initiatives and moves to accepted/rejected state depending on the votes collected when the signing period has finished
4+
5+
class MetricsJob < CronJob
6+
self.cron_expression = '30 7 * * *'
7+
8+
def perform
9+
Rails.application.load_tasks
10+
Rake::Task['decidim_initiatives:check_published'].invoke
11+
12+
true
13+
end
14+
end
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# frozen_string_literal: true
2+
3+
# Delete old registrations forms
4+
class MetricsJob < CronJob
5+
self.cron_expression = '3 0 * * *'
6+
7+
def perform
8+
Rails.application.load_tasks
9+
Rake::Task['decidim_meetings:clean_registration_forms'].invoke
10+
11+
true
12+
end
13+
end

app/jobs/metrics_job.rb renamed to app/jobs/decidim/remove_expired_download_your_data_files.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# frozen_string_literal: true
22

3-
# This job runs all Decidim metrics updates at midnight
3+
# Remove expired download your data files
44
class MetricsJob < CronJob
55
self.cron_expression = '0 0 * * *'
66

77
def perform
88
Rails.application.load_tasks
9-
Rake::Task['decidim:metrics:all'].execute
9+
Rake::Task['decidim:delete_download_your_data_files'].invoke
1010

1111
true
1212
end
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# frozen_string_literal: true
2+
3+
# Send notification mail digest daily
4+
class MetricsJob < CronJob
5+
self.cron_expression = '5 0 * * *'
6+
7+
def perform
8+
Rails.application.load_tasks
9+
Rake::Task['decidim:mailers:notifications_digest_daily'].invoke
10+
11+
true
12+
end
13+
end

0 commit comments

Comments
 (0)