Skip to content

Commit

Permalink
Adding new depts to lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbyt3r committed Oct 16, 2024
1 parent c5ab660 commit 608cb50
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion backend/tuber/api/uber.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ def sync_attendees(event):
badges = db.query(Badge).filter(Badge.event == event).options(joinedload(Badge.departments)).all()
badgelookup = {badge.uber_id: badge for badge in badges}

counter = 0
for idx, attendee in enumerate(eligible):
print(f"Importing {attendee}")
req = {
Expand All @@ -254,8 +255,9 @@ def sync_attendees(event):
else:
print(f"Skipping attendee {attendee} since I couldn't find it in Uber")
continue
if idx % 100 == 0:
if counter % 100 == 0:
g.progress(idx / len(eligible), status=f"Checking attendee {uber_model['full_name']}")
counter += 1
if attendee in badgelookup:
badge = badgelookup[attendee]
if uber_model['full_name'] != badge.public_name:
Expand Down Expand Up @@ -375,6 +377,7 @@ def staffer_auth(slug):
new_dept = Department(uber_id=dept_uber_id, event=event_obj.id, name=dept_name)
db.add(new_dept)
badge.departments.append(new_dept)
dept_by_uber_id[dept_uber_id] = new_dept
else:
dept = dept_by_uber_id[dept_uber_id]
if dept.name != dept_name:
Expand Down

0 comments on commit 608cb50

Please sign in to comment.