Commit ·
0279903
1
Parent(s): 627b8d1
fix: repair output_position on startup in web_app.py
Browse filesAlso run the output_position=primary_position sync at startup
(same fix as initialize_db, but runs immediately at gunicorn worker
start so existing live deployments fix their data without waiting
for a full DB reinit).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- web_app.py +7 -0
web_app.py
CHANGED
|
@@ -42,6 +42,13 @@ def create_app():
|
|
| 42 |
_c.execute(
|
| 43 |
"UPDATE schedule_periods SET gen_status='idle', gen_message='' WHERE gen_status='generating'"
|
| 44 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
_c.commit()
|
| 46 |
_c.close()
|
| 47 |
except Exception:
|
|
|
|
| 42 |
_c.execute(
|
| 43 |
"UPDATE schedule_periods SET gen_status='idle', gen_message='' WHERE gen_status='generating'"
|
| 44 |
)
|
| 45 |
+
# output_position と primary_position の不整合を修正
|
| 46 |
+
# (単一ポジション従業員の output_position が誤った値になっているケース)
|
| 47 |
+
_c.execute(
|
| 48 |
+
"UPDATE employees SET output_position = primary_position"
|
| 49 |
+
" WHERE primary_position IS NOT NULL"
|
| 50 |
+
" AND (output_position IS NULL OR output_position != primary_position)"
|
| 51 |
+
)
|
| 52 |
_c.commit()
|
| 53 |
_c.close()
|
| 54 |
except Exception:
|