From 79023f2acb4c1941b73a82f8d74387f969fec570 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Sun, 11 Feb 2024 15:01:24 +0100 Subject: [PATCH] Update code * update invoices * update invoice parsing code * update prize pool stats --- invoices.json | 39 +++++++++++++++++++++++++++++++++++++-- src/main.py | 6 +++--- src/util.py | 18 ++++++++++++++---- 3 files changed, 54 insertions(+), 9 deletions(-) diff --git a/invoices.json b/invoices.json index 615a703..ac2c72d 100644 --- a/invoices.json +++ b/invoices.json @@ -2,6 +2,41 @@ "data": { "walletHistory": { "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", "createdAt": "2024-01-21T09:30:03.480Z", @@ -56,7 +91,7 @@ "createdAt": "2023-12-23T16:52:11.103Z", "sats": 1000, "status": "CONFIRMED", - "invoiceComment": "100k bet - carlosfandango - 501" + "invoiceComment": "100k bet - Carlosfandango - 501" }, { "id": "141819", @@ -117,4 +152,4 @@ ] } } -} \ No newline at end of file +} diff --git a/src/main.py b/src/main.py index d71981c..6b5ef47 100644 --- a/src/main.py +++ b/src/main.py @@ -15,9 +15,9 @@ x================================+ ``` """) -# last updated: 2024-01-29 -legend_of_snail_stacked = 119600 -oracle_stacked = 13769 +# last updated: 2024-02-11 +legend_of_snail_stacked = 119603 # from database [sats] +oracle_stacked = 17711 # from profile [sats] prize_pool = legend_of_snail_stacked + oracle_stacked invoices_path = "invoices.json" diff --git a/src/util.py b/src/util.py index 7979b6d..28a27bc 100644 --- a/src/util.py +++ b/src/util.py @@ -35,10 +35,13 @@ def parse_invoices(invoices): Participant("grayruby", 655), Participant("nikotsla", 570), Participant("siggy47", 380), - Participant("Alby", 365, False), + Participant("Alby", 365), Participant("phatom", 440, False), - Participant("Longtermwizard", 700, True), - Participant("BitcoinIsTheFuture", 584, False) + Participant("Longtermwizard", 700), + 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: @@ -54,7 +57,14 @@ def parse_invoices(invoices): # print("invalid format:", comment) continue _, 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'))) return participants