From 91b61821169cca1cb524be14551726e61ef38a88 Mon Sep 17 00:00:00 2001 From: anon Date: Tue, 16 Aug 2022 00:22:07 -0300 Subject: [PATCH] 16/08 --- charts/views.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/charts/views.py b/charts/views.py index 044a2e5..7048bae 100644 --- a/charts/views.py +++ b/charts/views.py @@ -1357,7 +1357,7 @@ def update_database(date_from=None, date_to=None): # Get latest P2Pool data def update_p2pool(): today = date.today() - yesterday = date.today() - timedelta(2) + yesterday = date.today() - timedelta(1) try: p2pool_stat = P2Pool.objects.filter(mini=False).get(date=today) print('achou p2pool de hoje') @@ -1435,7 +1435,7 @@ def update_p2pool(): return data today = date.today() - yesterday = date.today() - timedelta(2) + yesterday = date.today() - timedelta(1) try: p2pool_stat = P2Pool.objects.filter(mini=True).get(date=today) print('achou p2pool_mini de hoje') @@ -5601,13 +5601,14 @@ def p2pool_totalblocks(request): now_combined += p2pool_stat.totalblocksfound totalblocks.append(now_totalblocks) - try: - p2pool_stat_mini = P2Pool.objects.filter(mini=True).get(date=p2pool_stat.date) - if p2pool_stat_mini.totalblocksfound > now_totalblocks_mini: + p2pool_stats_mini = P2Pool.objects.filter(mini=True).filter(date=p2pool_stat.date) + for p2pool_stat_mini in p2pool_stats_mini: + if p2pool_stat_mini.totalblocksfound >= now_totalblocks_mini: now_totalblocks_mini = p2pool_stat_mini.totalblocksfound - now_combined += p2pool_stat_mini.totalblocksfound - except: - pass + now_combined += p2pool_stat_mini.totalblocksfound + break + + totalblocks_mini.append(now_totalblocks_mini) combined.append(now_combined) @@ -5641,7 +5642,7 @@ def p2pool_totalhashes(request): try: p2pool_stat_mini = P2Pool.objects.filter(mini=True).get(date=p2pool_stat.date) - if p2pool_stat_mini.totalhashes > now_totalblocks_mini: + if p2pool_stat_mini.totalhashes >= now_totalblocks_mini: now_totalblocks_mini = p2pool_stat_mini.totalhashes/1000000000000 now_combined += p2pool_stat_mini.totalhashes/1000000000000 except: