auto-archive badly occurs in UTC time and not in local time (1 hour too late in France, 10 hours before in Tahiti ;-)

This commit is contained in:
maatinito 2019-11-11 16:14:27 -10:00 committed by simon lehericey
parent 6c2c3aae14
commit 14bc2b99b9
2 changed files with 2 additions and 2 deletions

View file

@ -2,7 +2,7 @@ class AutoArchiveProcedureJob < ApplicationJob
queue_as :cron
def perform(*args)
Procedure.publiees.where("auto_archive_on <= ?", Date.today).each do |procedure|
Procedure.publiees.where("auto_archive_on <= ?", Time.zone.today).each do |procedure|
procedure
.dossiers
.state_en_construction

View file

@ -3,7 +3,7 @@ require 'rails_helper'
RSpec.describe AutoArchiveProcedureJob, type: :job do
let!(:procedure) { create(:procedure, :published, :with_instructeur, auto_archive_on: nil) }
let!(:procedure_hier) { create(:procedure, :published, :with_instructeur, auto_archive_on: 1.day.ago) }
let!(:procedure_aujourdhui) { create(:procedure, :published, :with_instructeur, auto_archive_on: Date.today) }
let!(:procedure_aujourdhui) { create(:procedure, :published, :with_instructeur, auto_archive_on: Time.zone.today) }
let!(:procedure_demain) { create(:procedure, :published, :with_instructeur, auto_archive_on: 1.day.from_now) }
subject { AutoArchiveProcedureJob.new.perform }