in api/choice_algorithm.py [0:0]
def reset_wheel(wheel):
"""
Resets the weights of all participants in the wheel and updates the wheel's participant count
:param wheel: Wheel dictionary:
{
"id": string ID of the wheel (DDB Hash Key),
"name": string name of the wheel,
"participant_count": number of participants in the wheel,
}
:return: None
"""
count = 0
with WheelParticipant.batch_writer() as batch:
for p in WheelParticipant.iter_query(KeyConditionExpression=Key('wheel_id').eq(wheel['id'])):
p['weight'] = get_sub_wheel_size(p['name'])
batch.put_item(Item=p)
count += 1
Wheel.update_item(Key={'id': wheel['id']}, **to_update_kwargs({'participant_count': count}))