Open binary1230 opened 8 years ago
Also, same deal with some of the other ones like hotel requests:
psycopg2.IntegrityError: duplicate key value violates unique constraint "hotel_requests_attendee_id_key"
DETAIL: Key (attendee_id)=([secret-removed]) already exists.
I replaced the real attendee ID with [secret-removed] since that is sensitive info
So this was discussed in Slack - There error is caused when an Admin account is logged into uber and you try to log in with your Volunteer account to do Checklist items. It is only going to affect Uber Admin accounts that also try to log in to the checklist items. I am ok with it erroring out with 2 different logins from the same computer / same browser, different tabs.
I don't know that this is actually the cause. I just tried to repro that exact thing on the staging server and had no luck.
It's definitely something though where the information is getting submitted twice, maybe some case where we're not detecting that something else already exists
Yeah, there's nothing obvious from looking at the code, either.
Did we import these tables to MAGLabs at any point? It's possible that, say, we have a column on the FoodRestriction table that has an attendee id, but we don't have the foreign key on that attendee to connect it with the food restriction. Foreign keys aren't in the database, after all.
If that's the case, we could fix this by changing this line:
fr = attendee.food_restrictions or FoodRestrictions()
to something that looks up the attendee's ID in the food restrictions table. Alternatively, we can try to figure out how to import the foreign keys.
don't recall importing anything, so not sure. from what I can see, this was only happening with Mike, and he's OK now so we can let this simmer for a bit.
Mike P tripped this, not sure the circumstances. It looks like it might be when someone is trying to update food preferences on labs via the volunteer checklist probably (because staffer_id is set in the cherrypy session). It looks like it's trying to insert a second row with the same unique foreign attendee ID into the food_restrictions table.