mirror of
https://git.wownero.com/lza_menace/suchwow.git
synced 2024-08-15 01:03:19 +00:00
fix top post logic by checking incoming transfers
This commit is contained in:
parent
c05eda5253
commit
5c0cfdaa90
2 changed files with 17 additions and 2 deletions
|
@ -16,10 +16,16 @@ def top():
|
||||||
posts = Post.select()
|
posts = Post.select()
|
||||||
for post in posts:
|
for post in posts:
|
||||||
balance = float(wownero.Wallet().balances(post.account_index)[1])
|
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] = {
|
top_posts[post.id] = {
|
||||||
"post": post,
|
"post": post,
|
||||||
"balance": balance
|
"balance": total
|
||||||
}
|
}
|
||||||
return render_template("post/top.html", posts=top_posts)
|
return render_template("post/top.html", posts=top_posts)
|
||||||
|
|
||||||
|
|
|
@ -120,6 +120,15 @@ class Wallet(object):
|
||||||
sweep = self.make_wallet_rpc('sweep_all', data)
|
sweep = self.make_wallet_rpc('sweep_all', data)
|
||||||
return sweep
|
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):
|
def to_atomic(amount):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue