fix: registro ipes

crash por 'avance' de barra de progreso
no mostraba msg final.
This commit is contained in:
jp.av.dev 2022-05-21 00:35:14 -04:00
parent 3b8c52a565
commit 9901fc32f9

View File

@ -403,36 +403,14 @@ def registro_ips():
res = session.execute(statement).scalars().first() res = session.execute(statement).scalars().first()
total_act = len(session.execute(statement).scalars().all()) total_act = len(session.execute(statement).scalars().all())
avance = total_ant - total_act avance = total_ant - total_act
print('total update:',total,'total_act:', total_act,' Diferencia: ', avance ) #print('total update:',total,'total_act:', total_act,' Diferencia: ', avance )
total_ant = total_act total_ant = total_act
if res is None: if res is None:
print('en res none') progress.update (task1, advance=avance)
progress.update (task1, advance=total) else:
ip_actual= res.ip ip_actual= res.ip
ip_info = consulta_ip(ip_actual, True) ip_info = consulta_ip(ip_actual, True)
carga_registro_ip(ip_info) carga_registro_ip(ip_info)
progress.update(task1, advance=avance) progress.update(task1, advance=avance)
console.print('\n[bold yellow]Registro en baso de datos finalizado.[/bold yellow]') console.print('\n[bold yellow]Registro en base de datos finalizado.[/bold yellow]')
#def registro_ips(): # OLD
# registrar = True
# statement = select(Visita).filter_by(registro=0)
# while registrar:
# res = session.execute(statement).scalars().first()
# if res is None:
# console.print('[bold yellow]Registro en baso de datos finalizado.[/bold yellow]')
# registrar = False
# ip_actual= res.ip
# ip_info = consulta_ip(ip_actual, True)
# carga_registro_ip(ip_info)
#def test_db():
# try:
# session.add(Visita(ip='dummy_ip', cod_html=000, fecha=int(time.mktime(time.localtime()))))
# session.commit()
# session.add(Registro(ip ='dummy_ip'))
# session.commit()
# except Exception as ex:
# print('Exception: ', ex)