~singpolyma/jmp-pay

2ffb26dc4432bfc1219159e52a934173b374c51d — Stephen Paul Weber 9 months ago abb452a
Make days correct
1 files changed, 1 insertions(+), 1 deletions(-)

M bin/months_to_balance
M bin/months_to_balance => bin/months_to_balance +1 -1
@@ 30,7 30,7 @@ rows.each do |r|
			VALUES ($1, $2, $3, 'months_to_balance')
		SQL
		DB.exec(<<~SQL, [cid, r["expires_at"]])
			UPDATE plan_log SET date_range = date_range - tsrange(LOCALTIMESTAMP + '1 month', UPPER(date_range))
			UPDATE plan_log SET date_range = date_range - tsrange(LOCALTIMESTAMP + '1 month' + make_interval(days := (DATE_PART('day', UPPER(date_range)) - DATE_PART('day', LOCALTIMESTAMP))::int), UPPER(date_range))
			WHERE customer_id=$1 AND UPPER(date_range)=$2
		SQL
	end