~singpolyma/sgx-jmp

319b27a5d19e64a46fb2479c9265603d7007dcf0 — Stephen Paul Weber 3 months ago b85c697
Use default from Customer constructor
1 files changed, 4 insertions(+), 4 deletions(-)

M lib/customer_repo.rb
M lib/customer_repo.rb => lib/customer_repo.rb +4 -4
@@ 101,7 101,7 @@ protected

	def fetch_sql(customer_id)
		@db.query_defer(SQL, [customer_id]).then do |rows|
			rows.first&.transform_keys(&:to_sym) || { balance: 0 }
			rows.first&.transform_keys(&:to_sym) || {}
		end
	end



@@ 123,11 123,11 @@ protected
		fetch_all(customer_id).then do |(sgx, data)|
			Customer.new(
				customer_id, Blather::JID.new(jid),
				sgx: sgx, balance: data[:balance], tndetails: tndetails(sgx),
				sgx: sgx, tndetails: tndetails(sgx),
				plan: CustomerPlan.for(
					customer_id,
					**data.delete_if { |(k, _)| k == :balance }
				)
					**data.reject { |(k, _)| k == :balance }
				), **data.slice(:balance)
			)
		end
	end