fix: sql_update record_id missing on Vision ID models — update path now works
All create_update_*_v4 functions for event_badge, event_person, event_person_profile, event_presenter, and event_presentation were calling sql_update without record_id. Vision ID models use Optional[str] IDs with a root_validator that strips integer values, so the serialized dict contained no id key and sql_update could not identify the row. Fix: pass record_id=<integer_id> explicitly to sql_update in all five functions. Also fix walrus-operator false-negative: None return from sql_update (0 rows affected — record unchanged) is not an error and should not abort sub-object cascade; use explicit `is False` check. Also broadens Axonius badge_type_code mapping to substring match so future ticket name variants still resolve correctly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -322,11 +322,12 @@ def create_update_event_badge_obj_v4(
|
||||
elif event_person_id := event_badge_obj.event_person_id: pass
|
||||
|
||||
if event_badge_id:
|
||||
if event_badge_dict_up_result := sql_update(data=event_badge_dict, table_name='event_badge', rm_id_random=True): pass
|
||||
else:
|
||||
log.warning(f'Event Badge not updated. Event Badge ID: {event_badge_id}')
|
||||
event_badge_dict_up_result = sql_update(data=event_badge_dict, table_name='event_badge', record_id=event_badge_id, rm_id_random=True)
|
||||
if event_badge_dict_up_result is False:
|
||||
log.warning(f'Event Badge update failed (DB error). Event Badge ID: {event_badge_id}')
|
||||
log.debug(event_badge_dict_up_result)
|
||||
return False
|
||||
# None means 0 rows affected (record unchanged) — not an error
|
||||
log.debug(event_badge_dict_up_result)
|
||||
else:
|
||||
if event_badge_dict_in_result := sql_insert(data=event_badge_dict, table_name='event_badge', rm_id_random=True, id_random_length=None): pass
|
||||
|
||||
Reference in New Issue
Block a user