fixed problem with duplicate entrances
This commit is contained in:
parent
deaf592d6e
commit
09f7ccdb58
4 changed files with 32 additions and 9 deletions
|
@ -180,6 +180,8 @@ async def get_social_data(session, symbol):
|
|||
####################################################################################
|
||||
async def update_xmr_data(yesterday, coin):
|
||||
name = coin.name
|
||||
Coin.objects.filter(name=coin.name).filter(date=yesterday).delete()
|
||||
|
||||
url = 'https://xmrchain.net/api/networkinfo'
|
||||
response = requests.get(url)
|
||||
data = json.loads(response.text)
|
||||
|
|
|
@ -415,8 +415,6 @@ 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
|
||||
|
|
|
@ -891,6 +891,29 @@ async def index(request):
|
|||
if request.user.username != "Administrador" and request.user.username != "Morpheus":
|
||||
update_visitors(True)
|
||||
|
||||
# coins = Coin.objects.filter(name='xmr').order_by('-date')
|
||||
# for coin in coins:
|
||||
# if '2022-09-17' == datetime.datetime.strftime(coin.date, '%Y-%m-%d'):
|
||||
# coin.supply = 18175769
|
||||
# coin.save()
|
||||
# print('saved')
|
||||
# if '2022-09-16' == datetime.datetime.strftime(coin.date, '%Y-%m-%d'):
|
||||
# coin.supply = 18175284
|
||||
# coin.save()
|
||||
# print('saved')
|
||||
# if '2022-09-15' == datetime.datetime.strftime(coin.date, '%Y-%m-%d'):
|
||||
# coin.supply = 18174852
|
||||
# coin.save()
|
||||
# print('saved')
|
||||
# coins_aux = Coin.objects.filter(name='xmr').filter(date=coin.date)
|
||||
# count = 1
|
||||
# for coin_aux in coins_aux:
|
||||
# if count > 1:
|
||||
# print('deleted one')
|
||||
# print(coin_aux.date)
|
||||
# coin_aux.delete()
|
||||
# count += 1
|
||||
|
||||
dt = datetime.datetime.now(timezone.utc).timestamp()
|
||||
|
||||
coin = list(Coin.objects.order_by('-date'))[0]
|
||||
|
@ -901,6 +924,7 @@ async def index(request):
|
|||
|
||||
now = int(datetime.datetime.now().strftime("%H"))
|
||||
yesterday = datetime.datetime.strftime(date.today() - timedelta(1), '%Y-%m-%d')
|
||||
date_aux = datetime.datetime.strftime(date.today() - timedelta(2), '%Y-%m-%d')
|
||||
update_xmr = False
|
||||
update_btc = False
|
||||
|
||||
|
@ -947,11 +971,10 @@ async def index(request):
|
|||
except:
|
||||
print('no coins found yesterday - 2')
|
||||
update_btc = True
|
||||
|
||||
coins_xmr = Coin.objects.filter(name='xmr').order_by('-date')
|
||||
for coin_xmr in coins_xmr:
|
||||
if coin_xmr.supply > 0:
|
||||
break
|
||||
try:
|
||||
coin_xmr = Coin.objects.filter(name='xmr').get(date=date_aux)
|
||||
except:
|
||||
coin_xmr = list(Coin.objects.filter(name='xmr').order_by('-date'))[0]
|
||||
|
||||
if update_xmr:
|
||||
await asynchronous.update_xmr_data(yesterday, coin_xmr)
|
||||
|
|
|
@ -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']
|
||||
|
||||
|
|
Loading…
Reference in a new issue