diff --git a/funding/orm/orm.py b/funding/orm/orm.py index 3114397..66af310 100644 --- a/funding/orm/orm.py +++ b/funding/orm/orm.py @@ -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 diff --git a/funding/templates/comments.html b/funding/templates/comments.html index a502051..a1bd5de 100644 --- a/funding/templates/comments.html +++ b/funding/templates/comments.html @@ -1,3 +1,5 @@ +{% from 'proposal/macros/comment.html' import comment_entry %} +
- {{c.message}} -
- {% if not c.automated %} - reply - {% endif %} - - {% for _c in c.comments %} -
- - {{_c.message}} - -