From ca61e4e08e9aba0ea35a8d738b64c0e609d9ee99 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 10 Jul 2019 10:52:29 +0200 Subject: [PATCH] [bug] SubscriptionExpireWorker cannot run due to wrong expiration column in SQL query --- CHANGELOG.md | 1 + app/workers/subscription_expire_worker.rb | 2 +- ...703100457_change_start_at_to_expired_at_from_subscription.rb | 2 +- doc/postgresql_readme.md | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8646a3566..f6945bc9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ - Fix a bug: projects RSS feed fails to render - Fix a bug: abuses reports are not notified to admins +- Fix a bug: SubscriptionExpireWorker cannot run due to wrong expiration column in SQL query - Updated user's manual for v4 (fr) - Optimized Dockerfile to speed up build time diff --git a/app/workers/subscription_expire_worker.rb b/app/workers/subscription_expire_worker.rb index 32e8866c8..def238f70 100644 --- a/app/workers/subscription_expire_worker.rb +++ b/app/workers/subscription_expire_worker.rb @@ -2,7 +2,7 @@ class SubscriptionExpireWorker include Sidekiq::Worker def perform(expire_in) - Subscription.where('expired_at >= ?', Time.now.at_beginning_of_day).each do |s| + Subscription.where('expiration_date >= ?', Time.now.at_beginning_of_day).each do |s| if (s.expired_at - expire_in.days).to_date == Time.now.to_date if expire_in != 0 NotificationCenter.call type: 'notify_member_subscription_will_expire_in_7_days', diff --git a/db/migrate/20140703100457_change_start_at_to_expired_at_from_subscription.rb b/db/migrate/20140703100457_change_start_at_to_expired_at_from_subscription.rb index 054dcbbdb..2a3f191c6 100644 --- a/db/migrate/20140703100457_change_start_at_to_expired_at_from_subscription.rb +++ b/db/migrate/20140703100457_change_start_at_to_expired_at_from_subscription.rb @@ -4,7 +4,7 @@ class ChangeStartAtToExpiredAtFromSubscription < ActiveRecord::Migration add_column :subscriptions, :expired_at, :datetime Subscription.all.each do |s| - if s.respond_to? :expired_at and !s.expired_at? + if s.respond_to? :expired_at && !s.expired_at? if s.plan.interval == 'month' s.update_columns(expired_at: s.created_at + 1.month) else diff --git a/doc/postgresql_readme.md b/doc/postgresql_readme.md index dd1d915ec..be4fda6b3 100644 --- a/doc/postgresql_readme.md +++ b/doc/postgresql_readme.md @@ -31,7 +31,7 @@ tar cvzf fabmanager_production_$(date -I).tar.gz fabmanager_production_$(date -I If you're connected to your server thought SSH, you can download the resulting dump file using the following: ```bash -scp root@remote.server.fab:/apps/fabmanager/postgresql/dump/fabmanager_production_$(date -I).tar.gz . +scp root@remote.server.fab:/apps/fabmanager/postgresql/fabmanager_production_$(date -I).tar.gz . ``` Restore the dump with the following: