Update app.py
Browse files
app.py
CHANGED
@@ -312,7 +312,10 @@ def plot_ph_week():
|
|
312 |
week_number = request.args.get('week', default=1, type=int)
|
313 |
|
314 |
# Ограничиваем диапазон недели от 1 до 30
|
315 |
-
week_number
|
|
|
|
|
|
|
316 |
|
317 |
# Подключаемся к базе данных
|
318 |
conn = sqlite3.connect('system_data.db')
|
@@ -330,6 +333,7 @@ def plot_ph_week():
|
|
330 |
FROM system_data WHERE wek = ? ORDER BY date_time''', (week_number,))
|
331 |
rows = cursor.fetchall()
|
332 |
|
|
|
333 |
conn.close()
|
334 |
|
335 |
if not rows:
|
@@ -344,10 +348,10 @@ def plot_ph_week():
|
|
344 |
'onA': [float(row[4]) for row in rows],
|
345 |
'onB': [float(row[5]) for row in rows],
|
346 |
'onC': [float(row[6]) for row in rows],
|
347 |
-
'tS': [float(row[7]) for row in rows],
|
348 |
-
'tA': [float(row[8]) for row in rows],
|
349 |
-
'hDm': [float(row[9]) for row in rows],
|
350 |
-
'sVen': [float(row[10]) for row in rows],
|
351 |
'days_of_week': [int(row[3]) for row in rows]
|
352 |
}
|
353 |
|
@@ -370,6 +374,7 @@ def plot_ph_week():
|
|
370 |
|
371 |
|
372 |
|
|
|
373 |
@app.route("/")
|
374 |
def index():
|
375 |
return flask.render_template('index.html')
|
|
|
312 |
week_number = request.args.get('week', default=1, type=int)
|
313 |
|
314 |
# Ограничиваем диапазон недели от 1 до 30
|
315 |
+
if week_number < 1:
|
316 |
+
week_number = 1
|
317 |
+
elif week_number > 30:
|
318 |
+
week_number = 30
|
319 |
|
320 |
# Подключаемся к базе данных
|
321 |
conn = sqlite3.connect('system_data.db')
|
|
|
333 |
FROM system_data WHERE wek = ? ORDER BY date_time''', (week_number,))
|
334 |
rows = cursor.fetchall()
|
335 |
|
336 |
+
# Закрываем соединение с базой
|
337 |
conn.close()
|
338 |
|
339 |
if not rows:
|
|
|
348 |
'onA': [float(row[4]) for row in rows],
|
349 |
'onB': [float(row[5]) for row in rows],
|
350 |
'onC': [float(row[6]) for row in rows],
|
351 |
+
'tS': [float(row[7]) for row in rows], # Температура раствора
|
352 |
+
'tA': [float(row[8]) for row in rows], # Температура воздуха
|
353 |
+
'hDm': [float(row[9]) for row in rows], # Влажность воздуха
|
354 |
+
'sVen': [float(row[10]) for row in rows], # Обороты вентилятора
|
355 |
'days_of_week': [int(row[3]) for row in rows]
|
356 |
}
|
357 |
|
|
|
374 |
|
375 |
|
376 |
|
377 |
+
|
378 |
@app.route("/")
|
379 |
def index():
|
380 |
return flask.render_template('index.html')
|