05/06 Fix some notable and quality issues

This commit is contained in:
2026-05-06 11:47:20 -04:00
parent 830bb51f24
commit 02b3e1c45d
11 changed files with 125 additions and 46 deletions
+3 -2
View File
@@ -370,7 +370,8 @@ def execute(inspection_id):
inspection.completed_at = now_eastern()
_save_responses(inspection, responses)
db.session.commit()
# NOTE: do NOT commit here — inspection fields and all notification
# rows are staged together and committed atomically below.
inspection_link = url_for('inspections.view', inspection_id=inspection.id)
score_display = f'{score:.1f}%' if score is not None else 'N/A'
@@ -388,7 +389,7 @@ def execute(inspection_id):
facility_id = inspection.facility_id,
exclude_user_ids = {current_user.id},
)
db.session.commit()
db.session.commit() # Single atomic commit: inspection fields + notification rows
log_action(ACTION_UPDATE, 'Inspection', inspection.id,
f'{inspection.template.name} @ {inspection.facility.name}',
f'status=completed; score={score}')