summaryrefslogtreecommitdiff
path: root/src/value.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2014-02-21 13:04:45 -0600
committerJohn Wiegley <johnw@newartisans.com>2014-02-21 13:05:12 -0600
commitde8b078849e2254353cd0b04488f6d582e4e84c2 (patch)
tree1d9279052a8ddbd8eb1035806894a5c096b25010 /src/value.cc
parent1ec9f71479a7438f591316fa9004108ffad7594d (diff)
downloadfork-ledger-de8b078849e2254353cd0b04488f6d582e4e84c2.tar.gz
fork-ledger-de8b078849e2254353cd0b04488f6d582e4e84c2.tar.bz2
fork-ledger-de8b078849e2254353cd0b04488f6d582e4e84c2.zip
Attempt to convert balances to amounts before failing comparisons
Diffstat (limited to 'src/value.cc')
-rw-r--r--src/value.cc12
1 files changed, 12 insertions, 0 deletions
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;
}