Skip to content

Commit

Permalink
add update classification events
Browse files Browse the repository at this point in the history
  • Loading branch information
yuenmichelle1 committed Sep 20, 2023
1 parent 0a5824f commit 64be6a4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/user_group_membership_classification_backfill.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
classification_user_groups = list(map(lambda classification: (classification[0:8] + (user_group_id,)), classification_events_to_backfill))
eras_cursor.executemany("INSERT INTO classification_user_groups (classification_id, event_time, session_time, project_id, user_id, workflow_id, created_at, updated_at, user_group_id) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s)", classification_user_groups)

# update classification_events' user_group_ids so that it includes new classification_id
classification_events_to_update = list(map(lambda classification_event: {'classification_id': classification_event[0], 'user_group_ids': ([user_group_id] if classification_event[8] is None else classification_event[8] +[user_group_id])} ,classification_events_to_backfill))
eras_cursor.executemany("UPDATE classification_events SET user_group_ids = %(user_group_ids)s WHERE classification_id = %(classification_id)s", classification_events_to_update)

eras_conn.commit()

panoptes_cursor.close()
Expand Down

0 comments on commit 64be6a4

Please sign in to comment.