~singpolyma/jmp-pay

ceae65bf3328ab9dab1ee0076aa8cc6fa65b9a1e — Stephen Paul Weber 3 years ago d2d3d3c
If a user has no balance, then their balance is 0
1 files changed, 2 insertions(+), 2 deletions(-)

M bin/billing_monthly_cronjob
M bin/billing_monthly_cronjob => bin/billing_monthly_cronjob +2 -2
@@ 179,8 179,8 @@ end
db.transaction do
	db.exec(
		<<-SQL
		SELECT customer_id, plan_name, expires_at, balance
		FROM customer_plans INNER JOIN balances USING (customer_id)
		SELECT customer_id, plan_name, expires_at, COALESCE(balance, 0) AS balance
		FROM customer_plans LEFT JOIN balances USING (customer_id)
		WHERE expires_at <= NOW()
		SQL
	).each do |row|