update scripts
This commit is contained in:
parent
7010790739
commit
a6aea485af
|
@ -50,8 +50,13 @@ for post in all_data['posts']:
|
||||||
if 'in' in post['txes']:
|
if 'in' in post['txes']:
|
||||||
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():
|
amount = sum(tx['amounts'])
|
||||||
amount = sum(tx['amounts'])
|
received = TipReceived.select().where(
|
||||||
|
TipReceived.txid == tx['txid'],
|
||||||
|
TipReceived.amount == amount,
|
||||||
|
TipReceived.post == p
|
||||||
|
).first()
|
||||||
|
if not received:
|
||||||
TipReceived.create(
|
TipReceived.create(
|
||||||
post=p,
|
post=p,
|
||||||
timestamp=datetime.utcfromtimestamp(tx['timestamp']),
|
timestamp=datetime.utcfromtimestamp(tx['timestamp']),
|
||||||
|
|
|
@ -156,7 +156,8 @@ class Post(Model):
|
||||||
'approved': self.approved,
|
'approved': self.approved,
|
||||||
'approved_by': self.approved_by,
|
'approved_by': self.approved_by,
|
||||||
'received_wow': self.get_wow_received(),
|
'received_wow': self.get_wow_received(),
|
||||||
'hours_elapsed': self.hours_elapsed()
|
'hours_elapsed': self.hours_elapsed(),
|
||||||
|
'tips_received': [tip for tip in TipReceived.select().where(TipReceived.post == self)]
|
||||||
}
|
}
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -195,7 +196,7 @@ class AuditEvent(Model):
|
||||||
class TipReceived(Model):
|
class TipReceived(Model):
|
||||||
id = AutoField()
|
id = AutoField()
|
||||||
post = ForeignKeyField(Post)
|
post = ForeignKeyField(Post)
|
||||||
txid = CharField(unique=True)
|
txid = CharField()
|
||||||
timestamp = DateTimeField()
|
timestamp = DateTimeField()
|
||||||
amount = IntegerField()
|
amount = IntegerField()
|
||||||
fee = IntegerField()
|
fee = IntegerField()
|
||||||
|
@ -208,7 +209,7 @@ class TipSent(Model):
|
||||||
id = AutoField()
|
id = AutoField()
|
||||||
from_user = ForeignKeyField(User)
|
from_user = ForeignKeyField(User)
|
||||||
to_user = ForeignKeyField(User)
|
to_user = ForeignKeyField(User)
|
||||||
txid = CharField(unique=True)
|
txid = CharField()
|
||||||
timestamp = DateTimeField()
|
timestamp = DateTimeField()
|
||||||
amount = IntegerField()
|
amount = IntegerField()
|
||||||
fee = IntegerField()
|
fee = IntegerField()
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
rsync -avzP australia:/opt/suchwow/data/uploads/ data/uploads/
|
||||||
|
rsync -avzP australia:/opt/suchwow/data/sqlite.db data/sqlite.db
|
||||||
|
rsync -avzP australia:/opt/suchwow/data/migrate_data.pkl data/migrate_data.pkl
|
||||||
|
.venv/bin/python3 import.py
|
||||||
|
|
Loading…
Reference in New Issue