From c6303ab9efdb414a1809ec3413264037b31f092e Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 19 Jan 2009 22:30:46 -0400 Subject: Fixed the market valuation function for balances. --- src/balance.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/balance.cc') diff --git a/src/balance.cc b/src/balance.cc index 085d32b1..571f09c3 100644 --- a/src/balance.cc +++ b/src/balance.cc @@ -158,17 +158,19 @@ balance_t& balance_t::operator/=(const amount_t& amt) } optional -balance_t::value(const optional& moment) const +balance_t::value(const optional& moment, + const optional& in_terms_of) const { optional temp; - foreach (const amounts_map::value_type& pair, amounts) - if (optional val = pair.second.value(moment)) { - if (! temp) - temp = balance_t(); + foreach (const amounts_map::value_type& pair, amounts) { + if (! temp) + temp = balance_t(); + if (optional val = pair.second.value(moment, in_terms_of)) *temp += *val; - } - + else + *temp += pair.second; + } return temp; } -- cgit v1.2.3