in api/wheel_participant.py [0:0]
def delete_participant(event):
"""
Deletes the participant from the wheel and redistributes wheel weights
:param event: Lambda event containing the API Gateway request path parameters wheel_id and participant_id
{
"pathParameters":
{
"wheel_id": string ID of the wheel (DDB Hash Key)
"participant_id": string ID of the participant (DDB Hash Key)
},
}
:return: response dictionary
"""
wheel_id = event['pathParameters']['wheel_id']
participant_id = event['pathParameters']['participant_id']
# Make sure the wheel exists
wheel = Wheel.get_existing_item(Key={'id': wheel_id})
# REST-ful Deletes are idempotent and should not error if it's already been deleted
response = WheelParticipant.delete_item(Key={'wheel_id': wheel_id, 'id': participant_id}, ReturnValues='ALL_OLD')
if 'Attributes' in response:
choice_algorithm.on_participant_deletion(wheel, response['Attributes'])