Some template changes

This commit is contained in:
Sander Ferdinand 2018-10-20 18:25:58 +02:00
parent 470173db63
commit 92eac2ee20
No known key found for this signature in database
GPG key ID: 7BBC83D7A8810AAB
3 changed files with 56 additions and 89 deletions

View file

@ -246,7 +246,9 @@ class Proposal(base):
print('error; get_transfers_out; %d' % self.id)
return rtn
data['remaining_pct'] = 0.0
prices = Summary.fetch_prices()
for tx in data['txs']:
if prices:
tx['amount_usd'] = coin_to_usd(amt=tx['amount_human'], btc_per_coin=prices['coin-btc'], usd_per_btc=prices['btc-usd'])
@ -259,10 +261,10 @@ class Proposal(base):
data['pct'] = 0.0
data['spent'] = 0.0
if data['spent']:
data['remaining_pct'] = 100 / float(data['sum'] / data['spent'])
else:
data['remaining_pct'] = 0.0
cache_key_in = 'coin_balance_pid_%d' % self.id
data_in = cache.get(cache_key_in)
if data_in and data['spent']:
data['remaining_pct'] = 100 / float(data_in['sum'] / data['spent'])
return data