Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -36,6 +36,15 @@ def get_sql_for_question(message):
|
|
| 36 |
SELECT AVG(CT_Avg) as avg_current FROM machine_current_log
|
| 37 |
WHERE created_at >= NOW() - INTERVAL '1 day';
|
| 38 |
""", "Here's the average current over the past 24 hours:"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
elif "total current" in message:
|
| 41 |
return """
|
|
|
|
| 36 |
SELECT AVG(CT_Avg) as avg_current FROM machine_current_log
|
| 37 |
WHERE created_at >= NOW() - INTERVAL '1 day';
|
| 38 |
""", "Here's the average current over the past 24 hours:"
|
| 39 |
+
|
| 40 |
+
elif "total machines not faulty" in message:
|
| 41 |
+
return """
|
| 42 |
+
SELECT COUNT(DISTINCT machine_id)
|
| 43 |
+
FROM machine_current_log
|
| 44 |
+
WHERE fault_status = 'NOT_FAULTY'
|
| 45 |
+
AND created_at >= NOW() - INTERVAL '1 day';
|
| 46 |
+
""", "Here is the total number of machines that are not faulty today:"
|
| 47 |
+
|
| 48 |
|
| 49 |
elif "total current" in message:
|
| 50 |
return """
|