mirror of
https://git.wownero.com/lza_menace/suchwow.git
synced 2024-08-15 01:03:19 +00:00
update import/export scripts
This commit is contained in:
parent
ccb48a16c2
commit
df33eaf258
2 changed files with 9 additions and 5 deletions
|
@ -12,7 +12,7 @@ if not wallet.connected:
|
|||
print('Wallet not connected')
|
||||
exit()
|
||||
|
||||
all_posts = Post.select()
|
||||
all_posts = Post.select().order_by(Post.timestamp.desc())
|
||||
all_mods = Moderator.select()
|
||||
all_profiles = Profile.select()
|
||||
all_bans = Ban.select()
|
||||
|
@ -27,7 +27,7 @@ all_data = {
|
|||
|
||||
|
||||
for post in all_posts:
|
||||
all_data['posts'].append({
|
||||
post_data = {
|
||||
'id': post.id,
|
||||
'title': post.title,
|
||||
'text': post.text,
|
||||
|
@ -43,7 +43,9 @@ for post in all_posts:
|
|||
'to_discord': post.to_discord,
|
||||
'approved': post.approved,
|
||||
'txes': wallet.transfers(post.account_index)
|
||||
})
|
||||
}
|
||||
all_data['posts'].append(post_data)
|
||||
print(post_data['txes'])
|
||||
|
||||
for mod in all_mods:
|
||||
all_data['moderators'].append(mod.username)
|
||||
|
|
|
@ -51,11 +51,12 @@ for post in all_data['posts']:
|
|||
p = Post.get(post['id'])
|
||||
for tx in post['txes']['in']:
|
||||
if not TipReceived.select().where(TipReceived.txid == tx['txid']).first():
|
||||
amount = sum(tx['amounts'])
|
||||
TipReceived.create(
|
||||
post=p,
|
||||
timestamp=datetime.utcfromtimestamp(tx['timestamp']),
|
||||
txid=tx['txid'],
|
||||
amount=sum(tx['amounts']),
|
||||
amount=amount,
|
||||
fee=tx['fee']
|
||||
)
|
||||
print(f'Saving received tip txid {tx["txid"]}')
|
||||
|
@ -65,7 +66,8 @@ for post in all_data['posts']:
|
|||
for tx in post['txes']['out']:
|
||||
if not TipSent.select().where(TipSent.txid == tx['txid']).first():
|
||||
TipSent.create(
|
||||
user=p.user,
|
||||
from_user=p.user,
|
||||
to_user=p.user,
|
||||
txid=tx['txid'],
|
||||
timestamp=datetime.utcfromtimestamp(tx['timestamp']),
|
||||
amount=tx['amount'],
|
||||
|
|
Loading…
Reference in a new issue