From 494a9b64b2239a453c95cf465601e3e8cab75fb9 Mon Sep 17 00:00:00 2001 From: "Ivan R. Judson" Date: Thu, 8 Aug 2013 08:41:02 -0700 Subject: [PATCH] updated to be deterministic with users/statuses --- codalab/scripts/competitions.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/codalab/scripts/competitions.py b/codalab/scripts/competitions.py index 54d393d4f..5bcd3cce5 100644 --- a/codalab/scripts/competitions.py +++ b/codalab/scripts/competitions.py @@ -82,15 +82,17 @@ p, created = CompetitionPhase.objects.get_or_create(competition=brats2012, phasenumber=2, label="Competition Phase", start_date=p2date, max_submissions=1) +# Participant statuses, if they haven't been created before +statuses = ParticipantStatus.objects.all() + # Participants for the competition -participants = [ User.objects.get(username="guest%d" % random.choice(range(1,10))) for i in range(random.choice(range(1, 5)))] +participants = [ (statuses[i-2], User.objects.get(username="guest%d" % i)) for i in range(2,len(statuses)+2)] # Participant statuses, if they haven't been created before statuses = ParticipantStatus.objects.all() # Add participants to the competition with random statuses -for participant in participants: - status = random.choice(statuses) +for status, participant in participants: print "Adding %s to competition %s with status %s" % (participant, brats2012, status) resulting_participant, created = CompetitionParticipant.objects.get_or_create(user=participant, competition=brats2012, defaults={'status':status})