From de8b078849e2254353cd0b04488f6d582e4e84c2 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 21 Feb 2014 13:04:45 -0600 Subject: Attempt to convert balances to amounts before failing comparisons --- src/value.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/value.cc') diff --git a/src/value.cc b/src/value.cc index 75dc7d44..70a8ab43 100644 --- a/src/value.cc +++ b/src/value.cc @@ -870,6 +870,8 @@ bool value_t::is_less_than(const value_t& val) const return as_long() < val.as_long(); case AMOUNT: return val.as_amount() > as_long(); + case BALANCE: + return val.to_amount() > as_long(); default: break; } @@ -886,6 +888,8 @@ bool value_t::is_less_than(const value_t& val) const return as_amount() < val.as_amount(); else return commodity_t::compare_by_commodity()(&as_amount(), &val.as_amount()); + case BALANCE: + return val.to_amount() > as_amount(); default: break; } @@ -904,6 +908,8 @@ bool value_t::is_less_than(const value_t& val) const } return ! no_amounts; } + case BALANCE: + return val.to_amount() > to_amount(); default: break; } @@ -990,6 +996,8 @@ bool value_t::is_greater_than(const value_t& val) const return as_long() > val.as_long(); case AMOUNT: return val.as_amount() < as_long(); + case BALANCE: + return val.to_amount() < as_long(); default: break; } @@ -1001,6 +1009,8 @@ bool value_t::is_greater_than(const value_t& val) const return as_amount() > val.as_long(); case AMOUNT: return as_amount() > val.as_amount(); + case BALANCE: + return val.to_amount() < as_amount(); default: break; } @@ -1019,6 +1029,8 @@ bool value_t::is_greater_than(const value_t& val) const } return ! no_amounts; } + case BALANCE: + return val.to_amount() < to_amount(); default: break; } -- cgit v1.2.3