From 9ebd18e0c669f820fc3af381ffff8b996b2945d4 Mon Sep 17 00:00:00 2001 From: anon Date: Mon, 8 Aug 2022 23:07:20 -0300 Subject: [PATCH] 08/08 --- charts/models.py | 3 --- charts/templates/charts/fr.html | 2 +- charts/templates/charts/pt.html | 2 +- charts/views.py | 6 +++--- users/templates/users/base.html | 2 +- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/charts/models.py b/charts/models.py index b548ccd..8abd96b 100644 --- a/charts/models.py +++ b/charts/models.py @@ -144,6 +144,3 @@ class P2Pool(models.Model): miners = models.IntegerField() totalhashes = models.IntegerField() totalblocksfound = models.IntegerField() - - def __str__(self): - return self.date \ No newline at end of file diff --git a/charts/templates/charts/fr.html b/charts/templates/charts/fr.html index 1d26f8e..3933c5e 100644 --- a/charts/templates/charts/fr.html +++ b/charts/templates/charts/fr.html @@ -808,7 +808,7 @@ diff --git a/charts/templates/charts/pt.html b/charts/templates/charts/pt.html index 0f12c69..d22a452 100644 --- a/charts/templates/charts/pt.html +++ b/charts/templates/charts/pt.html @@ -538,7 +538,7 @@ diff --git a/charts/views.py b/charts/views.py index bd1526b..ceb2634 100644 --- a/charts/views.py +++ b/charts/views.py @@ -1242,7 +1242,7 @@ def update_database(date_from=None, date_to=None): # Get latest P2Pool data def get_latest_p2pool(): today = date.today() - yesterday = date.today() - timedelta(1) + yesterday = date.today() - timedelta(2) today = datetime.datetime.strftime(today, '%Y-%m-%d') try: print(1) @@ -1263,7 +1263,6 @@ def get_latest_p2pool(): print(6) return False except: - print(7) return False p2pool_stat = P2Pool() @@ -1271,10 +1270,11 @@ def get_latest_p2pool(): response = requests.get('https://p2pool.io/api/pool/stats') data = json.loads(response.text) + print(data) p2pool_stat.hashrate = data['pool_statistics']['hashRate'] p2pool_stat.percentage = 100*data['pool_statistics']['hashRate']/coin.hashrate p2pool_stat.miners = data['pool_statistics']['miners'] - p2pool_stat.totalhashes = data['pool_statistics']['3444692929009331,'] + p2pool_stat.totalhashes = data['pool_statistics']['totalHashes'] p2pool_stat.totalblocksfound = data['pool_statistics']['totalBlocksFound'] p2pool_stat.save() print('p2pool saved!') diff --git a/users/templates/users/base.html b/users/templates/users/base.html index 28ff5b6..1ebb531 100644 --- a/users/templates/users/base.html +++ b/users/templates/users/base.html @@ -144,7 +144,7 @@