|
@@ -183,20 +183,27 @@ async def tower(request: Request,company:str,factory:str,department:str,towerGro
|
|
|
@app.get('/optim', response_class=HTMLResponse)
|
|
|
async def optim(request: Request, Authorize: AuthJWT = Depends()):
|
|
|
db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/Water_tower?charset=utf8mb4')
|
|
|
- table=db['record_tower']
|
|
|
- temp = table.find_one(key = 'hotTemp')
|
|
|
+ statement = 'SELECT value FROM record_tower WHERE record_tower.key = "hotTemp"'
|
|
|
+ x = 0
|
|
|
+ y = 0
|
|
|
+ z = 0
|
|
|
+ for temp in db.query(statement):
|
|
|
+ print(temp['value'])
|
|
|
+ x=temp['value']
|
|
|
statement2 = 'SELECT value FROM record_tower WHERE record_tower.key = "coldTempData2"'
|
|
|
for temp2 in db.query(statement2):
|
|
|
print(temp2['value'])
|
|
|
+ y=temp2['value']
|
|
|
statement3 = 'SELECT value FROM record_tower WHERE record_tower.key = "wetTemp"'
|
|
|
for temp3 in db.query(statement3):
|
|
|
print(temp3['value'])
|
|
|
+ z=temp3['value']
|
|
|
try:
|
|
|
Authorize.jwt_required()
|
|
|
except Exception as e:
|
|
|
print(e)
|
|
|
return RedirectResponse('/login')
|
|
|
- return templates.TemplateResponse(name='optim.html',context={'request': request,"temp":temp,"temp2":temp2,"temp3":temp3})
|
|
|
+ return templates.TemplateResponse(name='optim.html',context={'request': request,"x":x,"y":y,"z":z})
|
|
|
|
|
|
|
|
|
@app.get('/vibration', response_class=HTMLResponse)
|