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')
|
print('Wallet not connected')
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
all_posts = Post.select()
|
all_posts = Post.select().order_by(Post.timestamp.desc())
|
||||||
all_mods = Moderator.select()
|
all_mods = Moderator.select()
|
||||||
all_profiles = Profile.select()
|
all_profiles = Profile.select()
|
||||||
all_bans = Ban.select()
|
all_bans = Ban.select()
|
||||||
|
@ -27,7 +27,7 @@ all_data = {
|
||||||
|
|
||||||
|
|
||||||
for post in all_posts:
|
for post in all_posts:
|
||||||
all_data['posts'].append({
|
post_data = {
|
||||||
'id': post.id,
|
'id': post.id,
|
||||||
'title': post.title,
|
'title': post.title,
|
||||||
'text': post.text,
|
'text': post.text,
|
||||||
|
@ -43,7 +43,9 @@ for post in all_posts:
|
||||||
'to_discord': post.to_discord,
|
'to_discord': post.to_discord,
|
||||||
'approved': post.approved,
|
'approved': post.approved,
|
||||||
'txes': wallet.transfers(post.account_index)
|
'txes': wallet.transfers(post.account_index)
|
||||||
})
|
}
|
||||||
|
all_data['posts'].append(post_data)
|
||||||
|
print(post_data['txes'])
|
||||||
|
|
||||||
for mod in all_mods:
|
for mod in all_mods:
|
||||||
all_data['moderators'].append(mod.username)
|
all_data['moderators'].append(mod.username)
|
||||||
|
|
|
@ -51,11 +51,12 @@ for post in all_data['posts']:
|
||||||
p = Post.get(post['id'])
|
p = Post.get(post['id'])
|
||||||
for tx in post['txes']['in']:
|
for tx in post['txes']['in']:
|
||||||
if not TipReceived.select().where(TipReceived.txid == tx['txid']).first():
|
if not TipReceived.select().where(TipReceived.txid == tx['txid']).first():
|
||||||
|
amount = sum(tx['amounts'])
|
||||||
TipReceived.create(
|
TipReceived.create(
|
||||||
post=p,
|
post=p,
|
||||||
timestamp=datetime.utcfromtimestamp(tx['timestamp']),
|
timestamp=datetime.utcfromtimestamp(tx['timestamp']),
|
||||||
txid=tx['txid'],
|
txid=tx['txid'],
|
||||||
amount=sum(tx['amounts']),
|
amount=amount,
|
||||||
fee=tx['fee']
|
fee=tx['fee']
|
||||||
)
|
)
|
||||||
print(f'Saving received tip txid {tx["txid"]}')
|
print(f'Saving received tip txid {tx["txid"]}')
|
||||||
|
@ -65,7 +66,8 @@ for post in all_data['posts']:
|
||||||
for tx in post['txes']['out']:
|
for tx in post['txes']['out']:
|
||||||
if not TipSent.select().where(TipSent.txid == tx['txid']).first():
|
if not TipSent.select().where(TipSent.txid == tx['txid']).first():
|
||||||
TipSent.create(
|
TipSent.create(
|
||||||
user=p.user,
|
from_user=p.user,
|
||||||
|
to_user=p.user,
|
||||||
txid=tx['txid'],
|
txid=tx['txid'],
|
||||||
timestamp=datetime.utcfromtimestamp(tx['timestamp']),
|
timestamp=datetime.utcfromtimestamp(tx['timestamp']),
|
||||||
amount=tx['amount'],
|
amount=tx['amount'],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue