Update code

* update invoices
* update invoice parsing code
* update prize pool stats
This commit is contained in:
ekzyis 2024-02-11 15:01:24 +01:00
parent 2417d61b18
commit 79023f2acb
3 changed files with 54 additions and 9 deletions

View File

@ -2,6 +2,41 @@
"data": { "data": {
"walletHistory": { "walletHistory": {
"facts": [ "facts": [
{
"id": "150638",
"createdAt": "2024-01-30T11:25:05.891Z",
"sats": 1000,
"status": "CONFIRMED",
"invoiceComment": "bitcoin $100k bet - Alby - 365"
},
{
"id": "150584",
"createdAt": "2024-01-30T04:21:22.678Z",
"sats": 1000,
"status": "CONFIRMED",
"invoiceComment": "Bitcoin $100k bet - @BitcoinIsTheFuture - 584 days"
},
{
"id": "150583",
"createdAt": "2024-01-30T04:19:52.084Z",
"sats": 1000,
"status": "EXPIRED",
"invoiceComment": "Bitcoin $100k bet - @BitcoinIsTheFuture - 584 days"
},
{
"id": "150541",
"createdAt": "2024-01-29T21:32:48.594Z",
"sats": 1000,
"status": "CONFIRMED",
"invoiceComment": "Bitcoin $100k bet July 04 2025 - Bitman"
},
{
"id": "150540",
"createdAt": "2024-01-29T21:26:24.013Z",
"sats": 1000,
"status": "EXPIRED",
"invoiceComment": "Bitcoin $100k bet July 03 2025"
},
{ {
"id": "148763", "id": "148763",
"createdAt": "2024-01-21T09:30:03.480Z", "createdAt": "2024-01-21T09:30:03.480Z",
@ -56,7 +91,7 @@
"createdAt": "2023-12-23T16:52:11.103Z", "createdAt": "2023-12-23T16:52:11.103Z",
"sats": 1000, "sats": 1000,
"status": "CONFIRMED", "status": "CONFIRMED",
"invoiceComment": "100k bet - carlosfandango - 501" "invoiceComment": "100k bet - Carlosfandango - 501"
}, },
{ {
"id": "141819", "id": "141819",
@ -117,4 +152,4 @@
] ]
} }
} }
} }

View File

@ -15,9 +15,9 @@ x================================+
``` ```
""") """)
# last updated: 2024-01-29 # last updated: 2024-02-11
legend_of_snail_stacked = 119600 legend_of_snail_stacked = 119603 # from database [sats]
oracle_stacked = 13769 oracle_stacked = 17711 # from profile [sats]
prize_pool = legend_of_snail_stacked + oracle_stacked prize_pool = legend_of_snail_stacked + oracle_stacked
invoices_path = "invoices.json" invoices_path = "invoices.json"

View File

@ -35,10 +35,13 @@ def parse_invoices(invoices):
Participant("grayruby", 655), Participant("grayruby", 655),
Participant("nikotsla", 570), Participant("nikotsla", 570),
Participant("siggy47", 380), Participant("siggy47", 380),
Participant("Alby", 365, False), Participant("Alby", 365),
Participant("phatom", 440, False), Participant("phatom", 440, False),
Participant("Longtermwizard", 700, True), Participant("Longtermwizard", 700),
Participant("BitcoinIsTheFuture", 584, False) Participant("BitcoinIsTheFuture", 584),
Participant("Bitman", 810),
# not bad format but I want to use lowercase nym like in SN
Participant("carlosfandango", 501),
] ]
for i in invoices: for i in invoices:
@ -54,7 +57,14 @@ def parse_invoices(invoices):
# print("invalid format:", comment) # print("invalid format:", comment)
continue continue
_, name, day = parts _, name, day = parts
participants.append(Participant(name, int(day))) # check if participant was not already added via hardcoded list
found = False
for p in participants:
if p.name.lower() == name.lower().strip("@"):
found = True
break
if not found:
participants.append(Participant(name, int(day)))
participants = list(sorted(participants, key=attrgetter('day'))) participants = list(sorted(participants, key=attrgetter('day')))
return participants return participants