~singpolyma/sgx-jmp

5f30fd792a817d2b053f66b97b1b060cea27c6b4 — Christopher Vollick 1 year, 4 months ago c3f3220
No Settled Transactions is 0, not Null

Unexpectedly this doesn't return either no columns or a column with a
value of 0, but instead a column with no value...
1 files changed, 1 insertions(+), 1 deletions(-)

M lib/trust_level_repo.rb
M lib/trust_level_repo.rb => lib/trust_level_repo.rb +1 -1
@@ 27,7 27,7 @@ protected

	def fetch_settled_amount(customer_id)
		db.query_one(<<~SQL, customer_id, default: {})
			SELECT SUM(amount) AS settled_amount FROM transactions
			SELECT COALESCE(SUM(amount), 0) AS settled_amount FROM transactions
			WHERE customer_id=$1 AND settled_after < LOCALTIMESTAMP AND amount > 0
		SQL
	end