コード例 #1
0
 def fuzzy_sum(self, currency, rounding=ROUND_UP):
     a = Money.ZEROS[currency].amount
     fuzzy = False
     for m in self:
         if m.currency == currency:
             a += m.amount
         elif m.amount:
             a += m.convert(currency, rounding=None).amount
             fuzzy = True
     r = Money(a, currency, rounding=rounding)
     r.fuzzy = fuzzy
     return r
コード例 #2
0
ファイル: currencies.py プロジェクト: neigara/liberapay.com
 def fuzzy_sum(self, currency, rounding=ROUND_UP):
     a = ZERO[currency].amount
     fuzzy = False
     for m in self:
         if m.currency == currency:
             a += m.amount
         elif m.amount:
             a += m.amount * website.currency_exchange_rates[(m.currency, currency)]
             fuzzy = True
     r = Money(a.quantize(D_CENT, rounding=rounding), currency)
     r.fuzzy = fuzzy
     return r
コード例 #3
0
ファイル: currencies.py プロジェクト: devmiyax/liberapay.com
 def fuzzy_sum(self, currency):
     a = ZERO[currency].amount
     fuzzy = False
     for m in self:
         if m.currency == currency:
             a += m.amount
         elif m.amount:
             a += m.amount * website.currency_exchange_rates[(m.currency, currency)]
             fuzzy = True
     r = Money(a, currency)
     r.fuzzy = fuzzy
     return r
コード例 #4
0
ファイル: currencies.py プロジェクト: liberapay/liberapay.com
 def fuzzy_sum(self, currency, rounding=ROUND_UP):
     a = Money.ZEROS[currency].amount
     fuzzy = False
     for m in self:
         if m.currency == currency:
             a += m.amount
         elif m.amount:
             a += m.convert(currency, rounding=None).amount
             fuzzy = True
     r = Money(a, currency, rounding=rounding)
     r.fuzzy = fuzzy
     return r
コード例 #5
0
 def fuzzy_sum(self, currency):
     a = ZERO[currency].amount
     fuzzy = False
     for m in self:
         if m.currency == currency:
             a += m.amount
         elif m.amount:
             a += m.amount * website.currency_exchange_rates[(m.currency,
                                                              currency)]
             fuzzy = True
     r = Money(a, currency)
     r.fuzzy = fuzzy
     return r