fix top post logic by checking incoming transfers

graphs-n-shit
lza_menace 4 years ago
parent c05eda5253
commit 5c0cfdaa90

@ -16,10 +16,16 @@ def top():
posts = Post.select()
for post in posts:
balance = float(wownero.Wallet().balances(post.account_index)[1])
if balance > 0:
transfers = []
incoming = wownero.Wallet().incoming_transfers(post.account_index)
if "transfers" in incoming:
for xfer in incoming["transfers"]:
transfers.append(wownero.from_atomic(xfer["amount"]))
total = sum(transfers)
if total > 0:
top_posts[post.id] = {
"post": post,
"balance": balance
"balance": total
}
return render_template("post/top.html", posts=top_posts)

@ -120,6 +120,15 @@ class Wallet(object):
sweep = self.make_wallet_rpc('sweep_all', data)
return sweep
def incoming_transfers(self, account, transfer_type='all', verbose=True):
data = {
'transfer_type': transfer_type,
'account_index': account,
'verbose': verbose
}
transfers = self.make_wallet_rpc('incoming_transfers', data)
return transfers
def to_atomic(amount):

Loading…
Cancel
Save