Don't renew if there is a future plan Note this means if there is a big hole between the end of current plan and the future plan that they won't renew properly.
1 files changed, 7 insertions(+), 1 deletions(-) M bin/billing_monthly_cronjob
M bin/billing_monthly_cronjob => bin/billing_monthly_cronjob +7 -1
@@ 88,7 88,13 @@ EM::Iterator.new(db.exec( FROM customer_plans WHERE expires_at <= LOCALTIMESTAMP + '4 days' AND expires_at > LOCALTIMESTAMP - INTERVAL '1 month' expires_at > LOCALTIMESTAMP - INTERVAL '1 month' AND ( SELECT COUNT(*) FROM plan_log WHERE customer_id=customer_plans.customer_id AND UPPER(date_range) > LOCALTIMESTAMP + '4 days' ) < 1; SQL ), 3).each(nil, -> { one << :done }) do |row, iter| customer = ExpiringCustomer.new(row["customer_id"])