Jul 30 - Update backend for iPad - inspector can re-inspect and create follow-up
This commit is contained in:
@@ -421,6 +421,19 @@ def create_inspection():
|
||||
sched = _resolve_schedule(data['scheduled_inspection_id'], user)
|
||||
scheduled_inspection_id = sched.id if sched else None
|
||||
|
||||
# phase45 — inherit the follow-up link from the schedule when the
|
||||
# client did not send one. A schedule created by "Schedule Follow-up"
|
||||
# knows which inspection it answers, so the link should not depend on
|
||||
# the client remembering to pass it: an older build, or a draft resumed
|
||||
# after the cached row was refreshed, would otherwise submit a plain
|
||||
# inspection and leave the parent flagged forever. Never overrides an
|
||||
# explicit parent_inspection_id.
|
||||
if not parent_inspection_id and sched and sched.parent_inspection_id:
|
||||
parent_inspection_id = sched.parent_inspection_id
|
||||
logger.info('API INSPECTIONS | parent inherited from schedule | '
|
||||
'schedule=%s | parent=%s | user=%s',
|
||||
sched.id, parent_inspection_id, user.username)
|
||||
|
||||
# ── Score calculation ─────────────────────────────────────────────────
|
||||
overall_score = data.get('overall_score')
|
||||
if overall_score is None and status == 'completed':
|
||||
|
||||
Reference in New Issue
Block a user