05/06 Fix some notable and quality issues
This commit is contained in:
@@ -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}')
|
||||
|
||||
Reference in New Issue
Block a user