From 23200e59e0f9b84a49aff98b6d10177b0fbbd3c8 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Wed, 9 Feb 2022 11:37:44 -0500 Subject: [PATCH] Transaction amounts are negative, but cdr charge is positive --- lib/call_attempt_repo.rb | 2 +- test/test_web.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/call_attempt_repo.rb b/lib/call_attempt_repo.rb index 52cc5f0..fd7e8d7 100644 --- a/lib/call_attempt_repo.rb +++ b/lib/call_attempt_repo.rb @@ -52,7 +52,7 @@ protected customer_id=$1 AND start > DATE_TRUNC('month', LOCALTIMESTAMP) SQL - promise.then { |rows| -(rows.first&.dig("a") || 0) } + promise.then { |rows| rows.first&.dig("a") || 0 } end def find_rate(plan_name, other_tel, direction) diff --git a/test/test_web.rb b/test/test_web.rb index 00fa423..5f5e810 100644 --- a/test/test_web.rb +++ b/test/test_web.rb @@ -82,9 +82,9 @@ class WebTest < Minitest::Test db: FakeDB.new( ["test_usd", "+15557654321", :outbound] => [{ "rate" => 0.01 }], ["test_usd", "+15557654321", :inbound] => [{ "rate" => 0.01 }], - ["customerid_limit"] => [{ "a" => -1000 }], - ["customerid_low"] => [{ "a" => -1000 }], - ["customerid_topup"] => [{ "a" => -1000 }] + ["customerid_limit"] => [{ "a" => 1000 }], + ["customerid_low"] => [{ "a" => 1000 }], + ["customerid_topup"] => [{ "a" => 1000 }] ) ) Web.opts[:common_logger] = FakeLog.new -- 2.45.2