diff options
author | John Wiegley <johnw@newartisans.com> | 2012-03-05 02:26:15 -0600 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2012-03-05 05:03:52 -0600 |
commit | 3ea5d88eb3ddfd8cac248fe96fdaa293e3b5bf70 (patch) | |
tree | 0024661e693aafdd6e34ccf0473cb08e4fe6574d /src/history.h | |
parent | 8d6bf11334562d7781b339cf822a93ff42fee2b5 (diff) | |
download | fork-ledger-3ea5d88eb3ddfd8cac248fe96fdaa293e3b5bf70.tar.gz fork-ledger-3ea5d88eb3ddfd8cac248fe96fdaa293e3b5bf70.tar.bz2 fork-ledger-3ea5d88eb3ddfd8cac248fe96fdaa293e3b5bf70.zip |
The last test is closer to working now
Diffstat (limited to 'src/history.h')
-rw-r--r-- | src/history.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/history.h b/src/history.h index eaca07ac..6430202b 100644 --- a/src/history.h +++ b/src/history.h @@ -90,18 +90,30 @@ public: template <typename Edge> bool operator()(const Edge& e) const { + DEBUG("history.find", " reftime = " << *reftime); + if (*last_reftime) + DEBUG("history.find", " last_reftime = " << **last_reftime); + if (*oldest) + DEBUG("history.find", " oldest = " << **oldest); + if (*last_oldest) + DEBUG("history.find", " last_oldest = " << **last_oldest); + if (*last_reftime && *reftime == **last_reftime && - *oldest == *last_oldest) + *oldest == *last_oldest) { + DEBUG("history.find", " using previous reftime"); return get(weight, e) != std::numeric_limits<std::size_t>::max(); + } const price_map_t& prices(get(ratios, e)); if (prices.empty()) { + DEBUG("history.find", " prices map is empty for this edge"); put(weight, e, std::numeric_limits<std::size_t>::max()); return false; } price_map_t::const_iterator low = prices.upper_bound(*reftime); if (low != prices.end() && low == prices.begin()) { + DEBUG("history.find", " don't use this edge"); put(weight, e, std::numeric_limits<std::size_t>::max()); return false; } else { @@ -109,6 +121,7 @@ public: assert(((*low).first <= *reftime)); if (*oldest && (*low).first < **oldest) { + DEBUG("history.find", " edge is out of range"); put(weight, e, std::numeric_limits<std::size_t>::max()); return false; } @@ -119,6 +132,8 @@ public: put(weight, e, secs); put(price_point, e, price_point_t((*low).first, (*low).second)); + DEBUG("history.find", " using edge at price point " + << (*low).first << " " << (*low).second); return true; } } |