Ejemplo n.º 1
0
def tables():
    db = get_db()
    registro = db.execute('select valor, fecha from records limit 10')
    
    salida = registro.fetchall()
    
    tablaEnteraDB=db.execute('select * from records')
    tablaEntera=tablaEnteraDB.fetchall()
    labels=[]
    values=[]
    tablaRegistros=[]
    for row in salida:
        labels.append(row[1])
        values.append(row[0])
    for line in tablaEntera:
        tablaRegistros.append(line)              
    updateTime=labels[-1]
    tablaRegistros=dynamicGraphs.getTablaRegistros()
    tablaRefrigeradores=dynamicGraphs.getTablaRefrigeradores()
    tablaEIoT=dynamicGraphs.getTablaEIoT()
    dictEiot=dynamicGraphs.getDispVarEiot()
    dictRefrig=dynamicGraphs.getDispVarRefrig()
    dictGrafEiot=dynamicGraphs.getTablesDVEiot(dictEiot)
    dictGrafRefrig=dynamicGraphs.getTablesDVRefrig(dictRefrig)
    #print(dictGrafEiot)
##    print("Tabla EIoT")
##    print(tablaEIoT)
##    print("Tabla Registros")
##    print(tablaRegistros)
    titulosTb=['Registros','Refrigeradores','EIoT']
    return render_template('tablas.html', values=values, labels=labels, updateTime=updateTime, tablaRegistros=tablaRegistros,
                           tablaRefrigeradores=tablaRefrigeradores,tablaEIoT=tablaEIoT,titulosTb=titulosTb,dictEiot=dictEiot,dictRefrig=dictRefrig,
                           dictGrafEiot=dictGrafEiot,dictGrafRefrig=dictGrafRefrig)
Ejemplo n.º 2
0
def actualizacion_tabla_eiot():
    db = get_db()
    fechaInicio = request.args.get('fechaInicio', 0)
    fechaFinal = request.args.get('fechaFinal', 0)
    tabla = request.args.get('tabla', 0)
    
    tablaEIoT[1]=dynamicGraphs.getTablaEIoT()
    return jsonify(tablaEIoT)