diff options
author | John Wiegley <johnw@newartisans.com> | 2012-03-19 00:30:15 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2012-03-19 00:30:15 -0500 |
commit | d6274fee19143554f232c9d0d78263bbd19efaed (patch) | |
tree | 0c95193deb6b0ec0ee8fb77e0cc0475292d23426 /src/commodity.cc | |
parent | db1bca2ad8a0a2890603ae96a6b980334d512041 (diff) | |
download | fork-ledger-d6274fee19143554f232c9d0d78263bbd19efaed.tar.gz fork-ledger-d6274fee19143554f232c9d0d78263bbd19efaed.tar.bz2 fork-ledger-d6274fee19143554f232c9d0d78263bbd19efaed.zip |
Extend commodity_t::compare_by_commodity::operator()
Diffstat (limited to 'src/commodity.cc')
-rw-r--r-- | src/commodity.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/commodity.cc b/src/commodity.cc index 0dad9a1a..5335d8a8 100644 --- a/src/commodity.cc +++ b/src/commodity.cc @@ -481,6 +481,15 @@ bool commodity_t::compare_by_commodity::operator()(const amount_t * left, if (aleftcomm.details.tag && arightcomm.details.tag) return *aleftcomm.details.tag < *arightcomm.details.tag; + if (! aleftcomm.details.value_expr && arightcomm.details.value_expr) + return true; + if (aleftcomm.details.value_expr && ! arightcomm.details.value_expr) + return false; + + if (aleftcomm.details.value_expr && arightcomm.details.value_expr) + return (aleftcomm.details.value_expr->text() < + arightcomm.details.value_expr->text()); + assert(false); return true; } |