new features

This commit is contained in:
anon 2022-09-18 10:11:33 -03:00
parent c7bf3c79c9
commit 80a73c40d7
3 changed files with 20 additions and 12 deletions

View file

@ -415,6 +415,8 @@ def update_database(date_from=None, date_to=None):
# Marketcap charts # Marketcap charts
data.btc_marketcap = coin_btc.priceusd*coin_btc.supply data.btc_marketcap = coin_btc.priceusd*coin_btc.supply
data.xmr_marketcap = coin_xmr.priceusd*coin_xmr.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.dash_marketcap = coin_dash.priceusd*coin_dash.supply
data.grin_marketcap = coin_grin.priceusd*coin_grin.supply data.grin_marketcap = coin_grin.priceusd*coin_grin.supply
data.zcash_marketcap = coin_zcash.priceusd*coin_zcash.supply data.zcash_marketcap = coin_zcash.priceusd*coin_zcash.supply

View file

@ -906,6 +906,8 @@ async def index(request):
if now > 1: if now > 1:
try: try:
coin_xmr = Coin.objects.filter(name='xmr').get(date=yesterday)
coin_xmr.delete()
coin_xmr = Coin.objects.filter(name='xmr').get(date=yesterday) coin_xmr = Coin.objects.filter(name='xmr').get(date=yesterday)
if coin_xmr: if coin_xmr:
print('xmr found yesterday') print('xmr found yesterday')
@ -925,21 +927,27 @@ async def index(request):
if now > 5: if now > 5:
try: try:
coin_btc = Coin.objects.filter(name='btc').get(date=yesterday) coin_btc = Coin.objects.filter(name='btc').filter(date=yesterday)
if coin_btc: coin_zec = Coin.objects.filter(name='zec').filter(date=yesterday)
print('btc found yesterday') coin_dash = Coin.objects.filter(name='dash').filter(date=yesterday)
if coin_btc.transactions > 0 and coin_btc.inflation > 0: coin_grin = Coin.objects.filter(name='grin').filter(date=yesterday)
print('no need to update btc') 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 update_btc = False
else: else:
print('will update btc') print('will update coins')
coin_btc.delete() coin_btc.delete()
coin_zec.delete()
coin_dash.delete()
coin_grin.delete()
update_btc = True update_btc = True
else: else:
print('no btc found yesterday - 1') print('no coins found yesterday - 1')
update_btc = True update_btc = True
except: except:
print('no btc found yesterday - 2') print('no coins found yesterday - 2')
update_btc = True update_btc = True
coins_xmr = Coin.objects.filter(name='xmr').order_by('-date') 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} 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) return render(request, 'charts/efficiency.html', context)
def compinflation(request): def compinflation(request):
if request.user.username != "Administrador" and request.user.username != "Morpheus": if request.user.username != "Administrador" and request.user.username != "Morpheus":
update_visitors(False) 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} '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) return render(request, 'charts/compinflation.html', context)
def comptransactions(request): def comptransactions(request):
if request.user.username != "Administrador" and request.user.username != "Morpheus": if request.user.username != "Administrador" and request.user.username != "Morpheus":
update_visitors(False) update_visitors(False)

View file

@ -28,8 +28,8 @@ STATICFILES_DIRS = [
SECRET_KEY = 'dafsdasdfasfa7sdfs9d7das7f9as7df8ad43525fsffdssdg455$$###77saf9df79as79s' SECRET_KEY = 'dafsdasdfasfa7sdfs9d7das7f9as7df8ad43525fsffdssdg455$$###77saf9df79as79s'
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True #DEBUG = True
#DEBUG = False DEBUG = False
ALLOWED_HOSTS = ['80.78.22.34', 'www.moneroj.net', 'localhost', '127.0.0.1', 'moneroj.net', 'moneroj5xq4ttg4ec7e5secqdyw5mcovzvfvlq6i7omv353i6mnexlqd.onion'] ALLOWED_HOSTS = ['80.78.22.34', 'www.moneroj.net', 'localhost', '127.0.0.1', 'moneroj.net', 'moneroj5xq4ttg4ec7e5secqdyw5mcovzvfvlq6i7omv353i6mnexlqd.onion']