Skip to content

Commit

Permalink
feat: update dupe handling logic using ignore conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
varshamenon4 committed Jul 25, 2024
1 parent a1e07da commit 55034b7
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ def add_course_staff_from_csv(self, csv_file, batch_size, batch_delay):
# bulk create course staff
for i in range(0, len(reader), batch_size):
CourseStaffRole.objects.bulk_create(
CourseStaffRole(
(CourseStaffRole(
user=User.objects.get(username=row.get('username')),
course_id=row.get('course_id'),
role=row.get('role'),
)
for row in reader[i:i + batch_size]
) for row in reader[i:i + batch_size]),
ignore_conflicts=True,
)
time.sleep(batch_delay)

0 comments on commit 55034b7

Please sign in to comment.