diff --git a/charts/synchronous.py b/charts/synchronous.py index 19efd84..66c1d9e 100644 --- a/charts/synchronous.py +++ b/charts/synchronous.py @@ -415,6 +415,8 @@ def update_database(date_from=None, date_to=None): # Marketcap charts data.btc_marketcap = coin_btc.priceusd*coin_btc.supply data.xmr_marketcap = coin_xmr.priceusd*coin_xmr.supply + print(coin_dash.priceusd) + print(coin_dash.supply) data.dash_marketcap = coin_dash.priceusd*coin_dash.supply data.grin_marketcap = coin_grin.priceusd*coin_grin.supply data.zcash_marketcap = coin_zcash.priceusd*coin_zcash.supply diff --git a/charts/views.py b/charts/views.py index 3f6e74e..5db456f 100644 --- a/charts/views.py +++ b/charts/views.py @@ -906,6 +906,8 @@ async def index(request): if now > 1: try: + coin_xmr = Coin.objects.filter(name='xmr').get(date=yesterday) + coin_xmr.delete() coin_xmr = Coin.objects.filter(name='xmr').get(date=yesterday) if coin_xmr: print('xmr found yesterday') @@ -925,21 +927,27 @@ async def index(request): if now > 5: try: - coin_btc = Coin.objects.filter(name='btc').get(date=yesterday) - if coin_btc: - print('btc found yesterday') - if coin_btc.transactions > 0 and coin_btc.inflation > 0: - print('no need to update btc') + coin_btc = Coin.objects.filter(name='btc').filter(date=yesterday) + coin_zec = Coin.objects.filter(name='zec').filter(date=yesterday) + coin_dash = Coin.objects.filter(name='dash').filter(date=yesterday) + coin_grin = Coin.objects.filter(name='grin').filter(date=yesterday) + if coin_btc and coin_zec and coin_dash and coin_grin: + print('coins found yesterday') + if coin_btc.transactions > 0 and coin_btc.inflation > 0 and coin_zec.supply > 0 and coin_dash.supply > 0 and coin_grin.supply > 0: + print('no need to update coins') update_btc = False else: - print('will update btc') + print('will update coins') coin_btc.delete() + coin_zec.delete() + coin_dash.delete() + coin_grin.delete() update_btc = True else: - print('no btc found yesterday - 1') + print('no coins found yesterday - 1') update_btc = True except: - print('no btc found yesterday - 2') + print('no coins found yesterday - 2') update_btc = True coins_xmr = Coin.objects.filter(name='xmr').order_by('-date') @@ -3429,7 +3437,6 @@ def efficiency(request): context = {'xmr_efficiency': xmr_efficiency, 'btc_efficiency': btc_efficiency, 'now_xmr': now_xmr, 'now_btc': now_btc, 'dates': dates} return render(request, 'charts/efficiency.html', context) - def compinflation(request): if request.user.username != "Administrador" and request.user.username != "Morpheus": update_visitors(False) @@ -3494,7 +3501,6 @@ def compinflation(request): 'now_xmr': now_xmr, 'now_btc': now_btc, 'now_dash': now_dash, 'now_grin': now_grin, 'now_zcash': now_zcash, 'now_btc': now_btc, 'dates': dates} return render(request, 'charts/compinflation.html', context) - def comptransactions(request): if request.user.username != "Administrador" and request.user.username != "Morpheus": update_visitors(False) diff --git a/moneropro/settings.py b/moneropro/settings.py index a15ec5a..6b8403f 100644 --- a/moneropro/settings.py +++ b/moneropro/settings.py @@ -28,8 +28,8 @@ STATICFILES_DIRS = [ SECRET_KEY = 'dafsdasdfasfa7sdfs9d7das7f9as7df8ad43525fsffdssdg455$$###77saf9df79as79s' # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True -#DEBUG = False +#DEBUG = True +DEBUG = False ALLOWED_HOSTS = ['80.78.22.34', 'www.moneroj.net', 'localhost', '127.0.0.1', 'moneroj.net', 'moneroj5xq4ttg4ec7e5secqdyw5mcovzvfvlq6i7omv353i6mnexlqd.onion']