Use base CronJob
This commit is contained in:
parent
5005c54891
commit
742cc15209
15 changed files with 30 additions and 30 deletions
|
@ -1,5 +1,5 @@
|
|||
class Administrateurs::ActivateBeforeExpirationJob < ApplicationJob
|
||||
queue_as :cron
|
||||
class AdministrateurActivateBeforeExpirationJob < CronJob
|
||||
self.cron_expression = "0 8 * * *"
|
||||
|
||||
def perform(*args)
|
||||
Administrateur
|
|
@ -1,5 +1,5 @@
|
|||
class AutoArchiveProcedureJob < ApplicationJob
|
||||
queue_as :cron
|
||||
class AutoArchiveProcedureJob < CronJob
|
||||
self.cron_expression = "* * * * *"
|
||||
|
||||
def perform(*args)
|
||||
Procedure.publiees.where("auto_archive_on <= ?", Time.zone.today).each do |procedure|
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class DeclarativeProceduresJob < ApplicationJob
|
||||
queue_as :cron
|
||||
class DeclarativeProceduresJob < CronJob
|
||||
self.cron_expression = "* * * * *"
|
||||
|
||||
def perform(*args)
|
||||
Procedure.declarative.find_each(&:process_dossiers!)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class DiscardedDossiersDeletionJob < ApplicationJob
|
||||
queue_as :cron
|
||||
class DiscardedDossiersDeletionJob < CronJob
|
||||
self.cron_expression = "0 7 * * *"
|
||||
|
||||
def perform(*args)
|
||||
Dossier.discarded_brouillon_expired.destroy_all
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class ExpiredDossiersDeletionJob < ApplicationJob
|
||||
queue_as :cron
|
||||
class ExpiredDossiersDeletionJob < CronJob
|
||||
self.cron_expression = "0 7 * * *"
|
||||
|
||||
def perform(*args)
|
||||
ExpiredDossiersDeletionService.process_expired_dossiers_brouillon
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class FindDubiousProceduresJob < ApplicationJob
|
||||
queue_as :cron
|
||||
class FindDubiousProceduresJob < CronJob
|
||||
self.cron_expression = "0 0 * * *"
|
||||
|
||||
FORBIDDEN_KEYWORDS = [
|
||||
'NIR', 'NIRPP', 'race', 'religion',
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class InstructeurEmailNotificationJob < ApplicationJob
|
||||
queue_as :cron
|
||||
class InstructeurEmailNotificationJob < CronJob
|
||||
self.cron_expression = "0 10 * * MON-FRI"
|
||||
|
||||
def perform(*args)
|
||||
NotificationService.send_instructeur_email_notification
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class NotifyDraftNotSubmittedJob < ApplicationJob
|
||||
queue_as :cron
|
||||
class NotifyDraftNotSubmittedJob < CronJob
|
||||
self.cron_expression = "0 7 * * *"
|
||||
|
||||
def perform(*args)
|
||||
Dossier.notify_draft_not_submitted
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class OperationsSignatureJob < ApplicationJob
|
||||
queue_as :cron
|
||||
class OperationsSignatureJob < CronJob
|
||||
self.cron_expression = "0 6 * * *"
|
||||
|
||||
def perform(*args)
|
||||
last_midnight = Time.zone.today.beginning_of_day
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class PurgeStaleExportsJob < ApplicationJob
|
||||
queue_as :cron
|
||||
class PurgeStaleExportsJob < CronJob
|
||||
self.cron_expression = "*/5 * * * *"
|
||||
|
||||
def perform
|
||||
Export.stale.destroy_all
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class PurgeUnattachedBlobsJob < ApplicationJob
|
||||
queue_as :cron
|
||||
class PurgeUnattachedBlobsJob < CronJob
|
||||
self.cron_expression = "0 0 * * *"
|
||||
|
||||
def perform(*args)
|
||||
ActiveStorage::Blob.unattached
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class UpdateAdministrateurUsageStatisticsJob < ApplicationJob
|
||||
queue_as :cron
|
||||
class UpdateAdministrateurUsageStatisticsJob < CronJob
|
||||
self.cron_expression = "0 10 * * *"
|
||||
|
||||
def perform
|
||||
AdministrateurUsageStatisticsService.new.update_administrateurs
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class WarnExpiringDossiersJob < ApplicationJob
|
||||
queue_as :cron
|
||||
class WarnExpiringDossiersJob < CronJob
|
||||
self.cron_expression = "0 0 1 * *"
|
||||
|
||||
def perform(*args)
|
||||
expiring, expired = Dossier
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class WeeklyOverviewJob < ApplicationJob
|
||||
queue_as :cron
|
||||
class WeeklyOverviewJob < CronJob
|
||||
self.cron_expression = "0 7 * * MON"
|
||||
|
||||
def perform(*args)
|
||||
# Feature flipped to avoid mails in staging due to unprocessed dossier
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Administrateurs::ActivateBeforeExpirationJob, type: :job do
|
||||
RSpec.describe AdministrateurActivateBeforeExpirationJob, type: :job do
|
||||
describe 'perform' do
|
||||
let(:administrateur) { create(:administrateur) }
|
||||
let(:user) { administrateur.user }
|
||||
let(:mailer_double) { double('mailer', deliver_later: true) }
|
||||
|
||||
subject { Administrateurs::ActivateBeforeExpirationJob.perform_now }
|
||||
subject { AdministrateurActivateBeforeExpirationJob.perform_now }
|
||||
|
||||
before do
|
||||
Timecop.freeze(Time.zone.local(2018, 03, 20))
|
Loading…
Reference in a new issue