[virtualcommons-svn] commit/vcweb: 5 new changesets
Status: Beta
Brought to you by:
alllee
From: Bitbucket <com...@bi...> - 2011-07-07 08:05:02
|
5 new changesets in vcweb: http://bitbucket.org/virtualcommons/vcweb/changeset/9db1221cfc7c/ changeset: 9db1221cfc7c user: alllee date: 2011-07-07 07:03:24 summary: fixes issue 24 affected #: 8 files (327 bytes) --- a/vcweb/core/models.py Wed Jul 06 12:16:47 2011 -0700 +++ b/vcweb/core/models.py Wed Jul 06 22:03:24 2011 -0700 @@ -124,8 +124,8 @@ The configuration for a given Experiment instance. One ExperimentConfiguration can be applied to many Experiment instances but can only be associated to a single ExperimentMetadata record. """ - experiment_metadata = models.ForeignKey(ExperimentMetadata, related_name='experiment_configurations') - creator = models.ForeignKey(Experimenter, related_name='experiment_configurations') + experiment_metadata = models.ForeignKey(ExperimentMetadata, related_name='experiment_configuration_set') + creator = models.ForeignKey(Experimenter, related_name='experiment_configuration_set') name = models.CharField(max_length=255) max_number_of_participants = models.PositiveIntegerField(default=0) date_created = models.DateField(auto_now_add=True) @@ -136,11 +136,11 @@ @property def final_sequence_number(self): # FIXME: or max round_configurations.sequence_number (degenerate data) - return self.round_configurations.count() + return self.round_configuration_set.count() @property def last_round_sequence_number(self): - return self.round_configurations.aggregate(sequence_number=Max('sequence_number'))['sequence_number'] + return self.round_configuration_set.aggregate(sequence_number=Max('sequence_number'))['sequence_number'] @property def namespace(self): @@ -186,11 +186,11 @@ current_round_sequence_number = models.PositiveIntegerField(default=1) """ Each round is assigned a sequential sequence number, ranging from 1 to N. Used to identify which round the experiment is currently running. """ - experimenter = models.ForeignKey(Experimenter, related_name='experiments') + experimenter = models.ForeignKey(Experimenter) """ the user running this experiment """ experiment_metadata = models.ForeignKey(ExperimentMetadata) """ the experiment metadata object that this experiment instance represents """ - experiment_configuration = models.ForeignKey(ExperimentConfiguration, related_name='experiments') + experiment_configuration = models.ForeignKey(ExperimentConfiguration) """ the configuration parameters in use for this experiment run. """ status = models.CharField(max_length=32, choices=STATUS_CHOICES, default='INACTIVE') @@ -265,8 +265,8 @@ @property def participant_group_relationships(self): - for group in self.groups.all(): - for pgr in group.participant_group_relationships.all(): + for group in self.group_set .all(): + for pgr in group.participant_group_relationship_set.all(): yield pgr @property @@ -316,7 +316,7 @@ @property def current_round_data(self): - round_data, created = self.round_data.get_or_create(round_configuration=self.current_round) + round_data, created = self.round_data_set.get_or_create(round_configuration=self.current_round) return round_data @property @@ -375,12 +375,12 @@ @property def all_participants_have_submitted(self): - pdvs = self.current_round_data.participant_data_values + pdvs = self.current_round_data.participant_data_value_set return pdvs.filter(submitted=False).count() == 0 def register_participants(self, users=None, emails=None, institution=None, password=None): - if self.participants.count() > 0: - logger.warning("This experiment %s already has %d participants - aborting", self, self.participants.count()) + if self.participant_set.count() > 0: + logger.warning("This experiment %s already has %d participants - aborting", self, self.participant_set.count()) return if users is None: users = [] @@ -406,8 +406,8 @@ ''' hardcoded defaults for the slovakia pretest ''' def setup_test_participants(self, count=20, institution=None, email_suffix='sav.sk', password='test'): - if self.participants.count() > 0: - logger.warning("This experiment %s already has %d participants - aborting", self, self.participants.count()) + if self.participant_set.count() > 0: + logger.warning("This experiment %s already has %d participants - aborting", self, self.participant_set.count()) return users = [] for i in xrange(1, count+1): @@ -431,25 +431,25 @@ if participant_parameters is None: participant_parameters = self.parameters(scope=Parameter.PARTICIPANT_SCOPE) current_round_data = self.current_round_data - for group in self.groups.select_related(depth=1).all(): + for group in self.group_set.select_related(depth=1).all(): for parameter in group_parameters: - group_data_value, created = current_round_data.group_data_values.get_or_create(group=group, parameter=parameter) + group_data_value, created = current_round_data.group_data_value_set.get_or_create(group=group, parameter=parameter) logger.debug("%s (%s)", group_data_value, created) - for pgr in group.participant_group_relationships.all(): + for pgr in group.participant_group_relationship_set.all(): for parameter in participant_parameters: - participant_data_value, created = current_round_data.participant_data_values.get_or_create(participant_group_relationship=pgr, parameter=parameter) + participant_data_value, created = current_round_data.participant_data_value_set.get_or_create(participant_group_relationship=pgr, parameter=parameter) logger.debug("%s (%s)", participant_data_value, created) def log(self, log_message): if log_message: logger.debug("%s: %s", self, log_message) - self.activity_log.create(round_configuration=self.current_round, log_message=log_message) + self.activity_log_set.create(round_configuration=self.current_round, log_message=log_message) def data_file_name(self, file_ext='csv'): return "%s_%s_%s.%s" % (slugify(self.experiment_metadata.title), self.pk, datetime.now().strftime("%d-%m-%y-%H%M"), file_ext) def parameters(self, scope=None): - ps = self.experiment_metadata.parameters + ps = self.experiment_metadata.parameter_set return ps.filter(scope=scope) if scope else ps def activate(self): @@ -462,10 +462,10 @@ def allocate_groups(self, randomize=True): # clear out all existing groups # FIXME: record previous mappings in activity log. - self.groups.all().delete() + self.group_set.all().delete() # seed the initial group. - current_group = self.groups.create(number=1, max_size=self.experiment_configuration.max_group_size) - participants = list(self.participants.all()) + current_group = self.group_set.create(number=1, max_size=self.experiment_configuration.max_group_size) + participants = list(self.participant_set.all()) if randomize: random.shuffle(participants) @@ -476,10 +476,10 @@ # XXX: if there a performance hit here, should probably do a void return instead # or collect the groups as they are added - return self.groups + return self.group_set def get_round_configuration(self, sequence_number): - return self.experiment_configuration.round_configurations.get(sequence_number=sequence_number) + return self.experiment_configuration.round_configuration_set.get(sequence_number=sequence_number) def get_template_path(self, name): return "%s/%s" % (self.namespace, name) @@ -560,12 +560,12 @@ ) def transfer_participants(self, experiment): - if experiment.participants.count() == 0: - for participant in self.participants.all(): + if experiment.participant_set.count() == 0: + for participant in self.participant_set.all(): ParticipantExperimentRelationship.objects.create(participant=participant, experiment=experiment, created_by=self.experimenter.user) else: - logger.warning("Tried to transfer participants to an experiment %s that already had participants %s", experiment, experiment.participants.all()) + logger.warning("Tried to transfer participants to an experiment %s that already had participants %s", experiment, experiment.participant_set.all()) def __unicode__(self): return u"%s #%s | %s" % (self.experiment_metadata.title, self.pk, self.experimenter) @@ -586,7 +586,7 @@ ROUND_TYPE_CHOICES = [(round_type, ROUND_TYPES_DICT[round_type][0]) for round_type in ROUND_TYPES] PLAYABLE_ROUND_CONFIGURATIONS = (PRACTICE, REGULAR) - experiment_configuration = models.ForeignKey(ExperimentConfiguration, related_name='round_configurations') + experiment_configuration = models.ForeignKey(ExperimentConfiguration, related_name='round_configuration_set') sequence_number = models.PositiveIntegerField(help_text='Used internally to determine the ordering of the rounds in an experiment in ascending order, e.g., 1,2,3,4,5') display_number = models.PositiveIntegerField(default=0, help_text='The round number to be displayed with this round. If set to zero, defaults to the internally used sequence_number.') @@ -661,20 +661,20 @@ def get_parameter(self, name): parameter = Parameter.objects.get(name=name, scope=Parameter.ROUND_SCOPE) - round_parameter, created = self.round_parameter_values.get_or_create(parameter=parameter) + round_parameter, created = self.round_parameter_value_set.get_or_create(parameter=parameter) if created: logger.debug("created new parameter %s for %s", parameter, self) return round_parameter def set_parameter(self, name=None, value=None): parameter = Parameter.objects.get(name=name, scope=Parameter.ROUND_SCOPE) - parameter_value, created = self.round_parameter_values.get_or_create(parameter=parameter) + parameter_value, created = self.round_parameter_value_set.get_or_create(parameter=parameter) parameter_value.value = value parameter_value.save() def get_parameter_value(self, name, default=None): try: - return self.round_parameter_values.get(parameter__name=name).value + return self.round_parameter_value_set.get(parameter__name=name).value except RoundParameterValue.DoesNotExist: return default @@ -707,8 +707,8 @@ answer = models.CharField(max_length=64) input_type = models.CharField(max_length=32) explanation = models.CharField(max_length=512) - round_configuration = models.ForeignKey(RoundConfiguration, related_name='quiz_questions') - experiment = models.ForeignKey(Experiment, related_name='default_quiz_questions', null=True, blank=True) + round_configuration = models.ForeignKey(RoundConfiguration, related_name='quiz_question_set') + experiment = models.ForeignKey(Experiment, related_name='default_quiz_question_set', null=True, blank=True) def is_correct(self, candidate): return self.answer == candidate @@ -764,7 +764,7 @@ date_created = models.DateTimeField(auto_now_add=True) last_modified = models.DateTimeField(auto_now=True) creator = models.ForeignKey(Experimenter) - experiment_metadata = models.ForeignKey(ExperimentMetadata, related_name='parameters') + experiment_metadata = models.ForeignKey(ExperimentMetadata) enum_choices = models.TextField(null=True, blank=True) is_required = models.BooleanField(default=False) @@ -817,6 +817,7 @@ class Meta: ordering = ['name'] + unique_together = ['name', 'experiment_metadata', 'scope'] class ParameterizedValue(models.Model): parameter = models.ForeignKey(Parameter) @@ -845,7 +846,7 @@ """ Represents a specific piece of round configuration data. """ - round_configuration = models.ForeignKey(RoundConfiguration, related_name='round_parameter_values') + round_configuration = models.ForeignKey(RoundConfiguration, related_name='round_parameter_value_set') def __unicode__(self): return u"{0} -> [{1}: {2}]".format(self.round_configuration, self.parameter, self.value) @@ -871,7 +872,7 @@ how many members can this group hold at a maximum? Could be specified as a RoundParameterValue / ExperimentConfiguration value """ - experiment = models.ForeignKey(Experiment, related_name='groups') + experiment = models.ForeignKey(Experiment) """ The experiment that contains this Group. """ @@ -887,7 +888,7 @@ @property def size(self): - return self.participants.count() + return self.participant_set.count() @property def current_round(self): @@ -895,7 +896,7 @@ @property def all_participants_str(self): - return ', '.join([participant.email for participant in self.participants.all()]) + return ', '.join([participant.email for participant in self.participant_set.all()]) @property def data_parameters(self): @@ -919,12 +920,12 @@ @property def current_round_activity_log(self): - return self.activity_log.filter(round_configuration=self.current_round) + return self.activity_log_set.filter(round_configuration=self.current_round) def log(self, log_message): if log_message: logger.debug(log_message) - self.activity_log.create(round_configuration=self.current_round, log_message=log_message) + self.activity_log_set.create(round_configuration=self.current_round, log_message=log_message) def subtract(self, parameter=None, amount=0): self.add(parameter, -amount) @@ -961,7 +962,7 @@ round_data = self.current_round_data criteria = self._data_parameter_criteria(parameter=parameter, parameter_name=parameter_name, round_data=round_data) try: - return self.data_values.get(**criteria) + return self.data_value_set.get(**criteria) except GroupRoundDataValue.DoesNotExist as e: logger.warning("No data value found for criteria %s", criteria) if default is None: @@ -1067,8 +1068,8 @@ (GroupRoundDataValue), participant_data (ParticipantRoundDataValue), and chat_messages (ChatMessage) """ - experiment = models.ForeignKey(Experiment, related_name='round_data') - round_configuration = models.ForeignKey(RoundConfiguration) + experiment = models.ForeignKey(Experiment, related_name='round_data_set') + round_configuration = models.ForeignKey(RoundConfiguration, related_name='round_data_set') elapsed_time = models.PositiveIntegerField(default=0) def __unicode__(self): @@ -1078,8 +1079,8 @@ ordering = [ 'round_configuration' ] class GroupRoundDataValue(DataValue): - group = models.ForeignKey(Group, related_name='data_values') - round_data = models.ForeignKey(RoundData, related_name='group_data_values') + group = models.ForeignKey(Group, related_name='data_value_set') + round_data = models.ForeignKey(RoundData, related_name='group_data_value_set') def __init__(self, *args, **kwargs): super(GroupRoundDataValue, self).__init__(*args, **kwargs) @@ -1100,8 +1101,8 @@ class Participant(CommonsUser): can_receive_invitations = models.BooleanField(default=False) - groups = models.ManyToManyField(Group, through='ParticipantGroupRelationship', related_name='participants') - experiments = models.ManyToManyField(Experiment, through='ParticipantExperimentRelationship', related_name='participants') + groups = models.ManyToManyField(Group, through='ParticipantGroupRelationship', related_name='participant_set') + experiments = models.ManyToManyField(Experiment, through='ParticipantExperimentRelationship', related_name='participant_set') @property def active_experiments(self): @@ -1131,10 +1132,10 @@ """ Many-to-many relationship entity storing a participant and the experiment they are participating in. """ - participant = models.ForeignKey(Participant, related_name='experiment_relationships') + participant = models.ForeignKey(Participant, related_name='experiment_relationship_set') participant_identifier = models.CharField(max_length=32) sequential_participant_identifier = models.PositiveIntegerField() - experiment = models.ForeignKey(Experiment, related_name='participant_relationships') + experiment = models.ForeignKey(Experiment, related_name='participant_relationship_set') date_created = models.DateTimeField(auto_now_add=True) created_by = models.ForeignKey(User) last_completed_round_sequence_number = models.PositiveIntegerField(default=0) @@ -1179,8 +1180,8 @@ round in which they joined the group, and the datetime that they joined the group. """ participant_number = models.PositiveIntegerField() - participant = models.ForeignKey(Participant, related_name='participant_group_relationships') - group = models.ForeignKey(Group, related_name = 'participant_group_relationships') + participant = models.ForeignKey(Participant, related_name='participant_group_relationship_set') + group = models.ForeignKey(Group, related_name = 'participant_group_relationship_set') round_joined = models.ForeignKey(RoundConfiguration) date_created = models.DateTimeField(auto_now_add=True) active = models.BooleanField(default=True) @@ -1200,7 +1201,7 @@ if parameter is not None and value is not None: # FIXME: make sure this is concurrent-safe or better yet that all participant data values are created at the # start of a round. - participant_data_value, created = current_round_data.participant_data_values.get_or_create(parameter=parameter, participant_group_relationship=self) + participant_data_value, created = current_round_data.participant_data_value_set.get_or_create(parameter=parameter, participant_group_relationship=self) participant_data_value.value = value # FIXME: parameterize / make explicit? participant_data_value.submitted = True @@ -1218,7 +1219,7 @@ class ChatMessageManager(models.Manager): def message(self, experiment, message): current_round_data = experiment.current_round_data - for participant in experiment.participants.all(): + for participant in experiment.participant_set.all(): yield ChatMessage.objects.create(participant_group_relationship=participant.get_participant_group_relationship(experiment), message=message, round_data=current_round_data) @@ -1228,19 +1229,19 @@ A chat message sent by a participant in a group to the rest of the members of the group or a target participant if target_participant is set. """ - participant_group_relationship = models.ForeignKey(ParticipantGroupRelationship, related_name='chat_messages') + participant_group_relationship = models.ForeignKey(ParticipantGroupRelationship, related_name='participant_chat_message_set') """ the combination of participant and group that generated this chat message """ message = models.CharField(max_length=512) """ the chat message """ - target_participant = models.ForeignKey(ParticipantGroupRelationship, null=True, blank=True, related_name='targets') + target_participant = models.ForeignKey(ParticipantGroupRelationship, null=True, blank=True, related_name='target_participant_chat_message_set') """ if set, this is a targeted message to the other participant in this group. If null, this is a broadcast message to the entire group """ date_created = models.DateTimeField(auto_now_add=True) """ the creation datetime of this chat message """ - round_data = models.ForeignKey(RoundData, related_name='chat_messages') + round_data = models.ForeignKey(RoundData, related_name='chat_message_set') """ the round data associated with this chat message """ objects = ChatMessageManager() @@ -1277,8 +1278,8 @@ (from DataValue), the round in which the data value was associated. """ class ParticipantRoundDataValue(DataValue): - round_data = models.ForeignKey(RoundData, related_name='participant_data_values') - participant_group_relationship = models.ForeignKey(ParticipantGroupRelationship, related_name='participant_data_values') + round_data = models.ForeignKey(RoundData, related_name='participant_data_value_set') + participant_group_relationship = models.ForeignKey(ParticipantGroupRelationship, related_name='participant_data_value_set') submitted = models.BooleanField(default=False) def __init__(self, *args, **kwargs): @@ -1318,14 +1319,14 @@ return u"%s - %s" % (self.date_created.strftime("%m-%d-%Y %H:%M"), self.log_message) class GroupActivityLog(ActivityLog): - group = models.ForeignKey(Group, related_name='activity_log') + group = models.ForeignKey(Group, related_name='activity_log_set') round_configuration = models.ForeignKey(RoundConfiguration) def __unicode__(self): return u"%s %s" % (self.group, super(GroupActivityLog, self).__unicode__()) class ExperimentActivityLog(ActivityLog): - experiment = models.ForeignKey(Experiment, related_name='activity_log') + experiment = models.ForeignKey(Experiment, related_name='activity_log_set') round_configuration = models.ForeignKey(RoundConfiguration) def is_experimenter(user, experimenter=None): --- a/vcweb/core/templates/experimenter/monitor.html Wed Jul 06 12:16:47 2011 -0700 +++ b/vcweb/core/templates/experimenter/monitor.html Wed Jul 06 22:03:24 2011 -0700 @@ -149,7 +149,7 @@ </div><div id='statusDiv'> {% block status %} - {% with participant_count=experiment.participants.count %} + {% with participant_count=experiment.participant_set.count %} <fieldset class='small ui-corner-all'><legend>round status</legend><ul id='actions' class='actions'> @@ -186,7 +186,7 @@ <li>Type: {{ experiment.current_round.get_round_type_display }}</li><li>Round started on {{ experiment.current_round_start_time }}</li><li>Time remaining: {{ experiment.time_remaining }}</li> - <li title='{{experiment.participants.all|join:" "}}'>Registered participants: <b>{{participant_count}}</b> + <li title='{{experiment.participant_set.all|join:" "}}'>Registered participants: <b>{{participant_count}}</b></li></ul></fieldset> --- a/vcweb/core/templates/experimenter/register-participants.html Wed Jul 06 12:16:47 2011 -0700 +++ b/vcweb/core/templates/experimenter/register-participants.html Wed Jul 06 22:03:24 2011 -0700 @@ -26,7 +26,7 @@ <p>Registering participants for <span style='padding:1px;' class='info'>{{experiment}}</span>. </p><p> - <span style='padding: 3px;' class='ui-state-highlight'><b>There are currently {{experiment.participants.count}} registered participants.</b></span> + <span style='padding: 3px;' class='ui-state-highlight'><b>There are currently {{experiment.participant_set.count}} registered participants.</b></span> {% include "includes/form-as-div.html" %} <div><button class='submit' type='submit'>Register</button> --- a/vcweb/core/tests.py Wed Jul 06 12:16:47 2011 -0700 +++ b/vcweb/core/tests.py Wed Jul 06 22:03:24 2011 -0700 @@ -22,7 +22,7 @@ experiment = Experiment.objects.get(pk=1).clone() else: experiment = self.create_new_experiment(experiment_metadata, **kwargs) - if experiment.participants.count() == 0: + if experiment.participant_set.count() == 0: experiment.setup_test_participants(email_suffix='asu.edu') logger.debug("loaded %s", experiment) self.experiment = experiment @@ -46,7 +46,7 @@ experiment_configuration = ExperimentConfiguration.objects.create(experiment_metadata=experiment_metadata, name='Test Experiment Configuration', creator=experimenter) for index in xrange(1, 10): - experiment_configuration.round_configurations.create(sequence_number=index) + experiment_configuration.round_configuration_set.create(sequence_number=index) return Experiment.objects.create(experimenter=self.experimenter, experiment_metadata=experiment_metadata, experiment_configuration=experiment_configuration) @@ -77,8 +77,7 @@ ) def create_new_parameter(self, name='vcweb.test.parameter', scope='EXPERIMENT_SCOPE', parameter_type='string'): - return self.experiment_metadata.parameters.create(creator=self.experimenter, - name=name, scope=scope, type=parameter_type) + return self.experiment_metadata.parameter_set.create(creator=self.experimenter, name=name, scope=scope, type=parameter_type) def create_new_group(self, max_size=10, experiment=None): @@ -158,8 +157,8 @@ def test_group_allocation(self): experiment = self.experiment experiment.allocate_groups(randomize=False) - self.assertEqual(experiment.groups.count(), 2, "there should be 2 groups after non-randomized allocation") - self.assertEqual(sum(map(lambda group:group.participants.count(), experiment.groups.all())), 10) + self.assertEqual(experiment.group_set.count(), 2, "there should be 2 groups after non-randomized allocation") + self.assertEqual( 10, sum([group.participant_set.count() for group in experiment.group_set]) ) def test_participant_numbering(self): experiment = self.experiment @@ -200,21 +199,21 @@ e.start_round() # instructions round current_round_data = e.current_round_data - self.assertEqual(current_round_data.group_data_values.count(), 0) - self.assertEqual(current_round_data.participant_data_values.count(), 0) + self.assertEqual(current_round_data.group_data_value_set.count(), 0) + self.assertEqual(current_round_data.participant_data_value_set.count(), 0) def test_playable_round(self): e = self.advance_to_data_round() e.start_round() current_round_data = e.current_round_data - for group in e.groups.all(): + for group in e.group_set.all(): for parameter in group.data_parameters.all(): - group_data_value, created = current_round_data.group_data_values.get_or_create(group=group, + group_data_value, created = current_round_data.group_data_value_set.get_or_create(group=group, parameter=parameter) self.assertFalse(created) - for pgr in group.participant_group_relationships.all(): + for pgr in group.participant_group_relationship_set.all(): for parameter in e.parameters(scope=Parameter.PARTICIPANT_SCOPE): - participant_data_value, created = current_round_data.participant_data_values.get_or_create(participant_group_relationship=pgr, + participant_data_value, created = current_round_data.participant_data_value_set.get_or_create(participant_group_relationship=pgr, parameter=parameter) self.assertFalse(created) @@ -222,9 +221,9 @@ def test_set_data_value_activity_log(self): e = self.advance_to_data_round() test_data_value = 10 - for g in e.groups.all(): + for g in e.group_set.all(): activity_log_counter = GroupActivityLog.objects.filter(group=g).count() - for data_value in g.data_values.all(): + for data_value in g.data_value_set.all(): # XXX: pathological use of set_data_value, no point in doing it # this way since typical usage would do a lookup by name. g.set_data_value(parameter=data_value.parameter, value=test_data_value) @@ -239,14 +238,14 @@ first_pass = True while e.has_next_round: if first_pass: - for g in e.groups.all(): + for g in e.group_set.all(): g.set_data_value(parameter=parameter, value=test_data_value) self.assertEqual(g.get_data_value(parameter=parameter).value, test_data_value) self.assertEqual(g.get_scalar_data_value(parameter=parameter), test_data_value) g.transfer_to_next_round(parameter) first_pass = False else: - for g in e.groups.all(): + for g in e.group_set.all(): self.assertEqual(g.get_data_value(parameter=parameter).value, test_data_value) self.assertEqual(g.get_scalar_data_value(parameter=parameter), test_data_value) g.transfer_to_next_round(parameter) @@ -263,8 +262,8 @@ for p in self.participants: g.add_participant(p) count += 1 - self.assertTrue(g.participants) - self.assertEqual(g.participants.count(), count, "group.participants size should be %i" % count) + self.assertTrue(g.participant_set) + self.assertEqual(g.participant_set.count(), count, "group.participants size should be %i" % count) self.assertEqual(g.size, count, "group size should be %i" % count) @@ -281,7 +280,7 @@ self.assertTrue(per.participant_identifier) self.assertTrue(per.sequential_participant_identifier > 0) - self.assertEqual(e.participants.count(), self.participants.count()) + self.assertEqual(e.participant_set.count(), self.participants.count()) class RoundConfigurationTest(BaseVcwebTest): --- a/vcweb/core/views.py Wed Jul 06 12:16:47 2011 -0700 +++ b/vcweb/core/views.py Wed Jul 06 22:03:24 2011 -0700 @@ -218,7 +218,7 @@ class ParticipantSingleExperimentMixin(SingleExperimentMixin, ParticipantMixin): def check_user(self, user, experiment): - # FIXME: should we do a user.participant in experiment.participants.all() check? + # FIXME: should we do a user.participant in experiment.participant_set.all() check? return experiment class ExperimenterSingleExperimentMixin(SingleExperimentMixin, ExperimenterMixin): @@ -275,7 +275,7 @@ class ClearParticipantsExperimentView(ExperimenterSingleExperimentView): def process_experiment(self, experiment): - experiment.participants.all().delete() + experiment.participant_set.all().delete() return experiment def render_to_response(self, context): return redirect('core:dashboard') --- a/vcweb/forestry/models.py Wed Jul 06 12:16:47 2011 -0700 +++ b/vcweb/forestry/models.py Wed Jul 06 22:03:24 2011 -0700 @@ -119,7 +119,7 @@ if should_reset_resource_level(round_configuration): initial_resource_level = get_initial_resource_level(round_configuration) logger.debug("Resetting resource level for %s to %d", round_configuration, initial_resource_level) - for group in experiment.groups.all(): + for group in experiment.group_set.all(): ''' set resource level to initial default ''' group.log("Setting resource level to initial value [%s]" % initial_resource_level) set_resource_level(group, initial_resource_level) @@ -136,7 +136,7 @@ current_round_configuration = experiment.current_round logger.debug("current round: %s", current_round_configuration) max_resource_level = 100 - for group in experiment.groups.all(): + for group in experiment.group_set.all(): # FIXME: simplify logic if has_resource_level(group): current_resource_level = get_resource_level(group) --- a/vcweb/forestry/tests.py Wed Jul 06 12:16:47 2011 -0700 +++ b/vcweb/forestry/tests.py Wed Jul 06 22:03:24 2011 -0700 @@ -17,7 +17,7 @@ def test_round_started_signal(self): e = self.advance_to_data_round() e.start_round(sender=forestry_sender) - for group in e.groups.all(): + for group in e.group_set.all(): self.verify_resource_level(group) return e @@ -26,18 +26,18 @@ # manually invoke round_setup, otherwise start_round should work as # well (but that's tested in the signal tests) round_setup(e) - for group in e.groups.all(): + for group in e.group_set.all(): self.verify_resource_level(group) return e def verify_round_ended(self, e, end_round_func): current_round_data = e.current_round_data harvest_decision_parameter = get_harvest_decision_parameter() - for group in e.groups.all(): + for group in e.group_set.all(): ds = get_harvest_decisions(group) self.verify_resource_level(group) - self.assertEqual(len(ds), group.participants.count()) - for pgr in group.participant_group_relationships.all(): + self.assertEqual(len(ds), group.participant_set.count()) + for pgr in group.participant_group_relationship_set.all(): pdv = ParticipantRoundDataValue.objects.get( parameter=harvest_decision_parameter, participant_group_relationship=pgr, @@ -90,7 +90,7 @@ if current_round_configuration.is_playable_round: expected_resource_level = calculate_expected_resource_level(expected_resource_level, max_harvest_decision * 5) - for group in e.groups.all(): + for group in e.group_set.all(): self.assertEquals(get_resource_level(pgr.group).value, expected_resource_level) if e.has_next_round: @@ -107,14 +107,14 @@ e.start_round() current_round_data = e.current_round_data group_parameters = (get_regrowth_parameter(), get_group_harvest_parameter(), get_resource_level_parameter()) - for group in e.groups.select_related(depth=1).all(): + for group in e.group_set.select_related(depth=1).all(): for parameter in group_parameters: - group_data_value = group.data_values.get(round_data=current_round_data, parameter=parameter) + group_data_value = group.data_value_set.get(round_data=current_round_data, parameter=parameter) self.assertTrue(group_data_value.parameter in group_parameters) self.assertTrue(group_data_value) # single participant data parameter, harvest decisions - for pgr in group.participant_group_relationships.all(): - prdv = pgr.participant_data_values.get(round_data=current_round_data, + for pgr in group.participant_group_relationship_set.all(): + prdv = pgr.participant_data_value_set.get(round_data=current_round_data, parameter=get_harvest_decision_parameter()) self.assertTrue(prdv) self.assertEquals(prdv.parameter, get_harvest_decision_parameter()) @@ -124,12 +124,12 @@ # generate harvest decisions current_round_data = e.current_round_data harvest_decision_parameter = get_harvest_decision_parameter() - for group in e.groups.all(): + for group in e.group_set.all(): ds = get_harvest_decisions(group) - self.assertEquals(len(ds), group.participants.count()) - for p in group.participants.all(): + self.assertEquals(len(ds), group.participant_set.count()) + for p in group.participant_set.all(): pgr = ParticipantGroupRelationship.objects.get(participant=p, group=group) - pdv, created = current_round_data.participant_data_values.get_or_create( + pdv, created = current_round_data.participant_data_value_set.get_or_create( participant_group_relationship=pgr, parameter=harvest_decision_parameter) self.assertFalse(created) @@ -176,22 +176,22 @@ def test_get_set_resource_level(self): e = self.advance_to_data_round() e.start_round() - for group in e.groups.all(): + for group in e.group_set.all(): resource_level = get_resource_level(group) self.assertTrue(resource_level.pk > 0) self.assertEqual(resource_level.value, 100) resource_level.value = 3 resource_level.save() - for group in e.groups.all(): + for group in e.group_set.all(): resource_level = get_resource_level(group) self.assertEqual(resource_level.value, 3) - for group in e.groups.all(): + for group in e.group_set.all(): set_resource_level(group, 100) self.assertEqual(get_resource_level(group).value, 100) - for group in e.groups.all(): + for group in e.group_set.all(): resource_level = get_resource_level(group) self.assertEqual(resource_level.value, 100) @@ -201,7 +201,7 @@ for e in self.all_data_rounds(): self.assertNotEqual(current_round_data, e.current_round_data) current_round_data = e.current_round_data - for data_value in current_round_data.group_data_values.filter(parameter__name='resource_level'): + for data_value in current_round_data.group_data_value_set.filter(parameter__name='resource_level'): self.assertTrue(data_value.pk > 0) self.assertEqual('resource_level', data_value.parameter.name) data_value.value = 50 @@ -210,7 +210,7 @@ data_value.value = 100 data_value.save() self.assertEqual(100, data_value.value) - self.assertEqual(e.current_round_data.group_data_values.count(), GroupRoundDataValue.objects.filter(experiment=e, round_data=current_round_data).count()) + self.assertEqual(e.current_round_data.group_data_value_set.count(), GroupRoundDataValue.objects.filter(experiment=e, round_data=current_round_data).count()) self.assertEqual(e.parameters(scope=Parameter.GROUP_SCOPE).count(), 3) data_round_number += 1 @@ -231,7 +231,7 @@ for p in self.participants: pexpr = ParticipantExperimentRelationship.objects.get(participant=p, experiment=e) pgroupr = ParticipantGroupRelationship.objects.get(group__experiment=e, participant=p) - current_round_data.participant_data_values.create(participant_group_relationship=pgroupr, parameter=data_param, value=pexpr.sequential_participant_identifier * 2) + current_round_data.participant_data_value_set.create(participant_group_relationship=pgroupr, parameter=data_param, value=pexpr.sequential_participant_identifier * 2) return e def test_data_values(self): @@ -244,7 +244,7 @@ e = self.create_participant_data_values() current_round_data = e.current_round_data for p in self.participants: - participant_data_values = current_round_data.participant_data_values.filter(participant_group_relationship__participant=p) + participant_data_values = current_round_data.participant_data_value_set.filter(participant_group_relationship__participant=p) self.assertEqual(participant_data_values.count(), 1) pexpr = p.get_participant_experiment_relationship(e) logger.debug("relationship %s" % pexpr) --- a/vcweb/lighterprints/tests.py Wed Jul 06 12:16:47 2011 -0700 +++ b/vcweb/lighterprints/tests.py Wed Jul 06 22:03:24 2011 -0700 @@ -34,7 +34,7 @@ # initialize participant carbon savings for participant_group_relationship in ParticipantGroupRelationship.objects.filter(group__experiment=e): for activity in Activity.objects.all(): - activity_performed, created = participant_group_relationship.participant_data_values.get_or_create(round_data=current_round_data, parameter=parameter) + activity_performed, created = participant_group_relationship.participant_data_value_set.get_or_create(round_data=current_round_data, parameter=parameter) activity_performed.value = activity.pk logger.debug("activity performed %s (%s)", activity_performed, created) http://bitbucket.org/virtualcommons/vcweb/changeset/a24cd2f26036/ changeset: a24cd2f26036 user: alllee date: 2011-07-07 08:20:03 summary: fixing core tests affected #: 2 files (289 bytes) --- a/vcweb/core/models.py Wed Jul 06 22:03:24 2011 -0700 +++ b/vcweb/core/models.py Wed Jul 06 23:20:03 2011 -0700 @@ -158,7 +158,7 @@ return self.filter(status='ACTIVE') def increment_elapsed_time(self, status='ROUND_IN_PROGRESS', amount=60): - if status: + if status is not None: es = self.filter(status=status) es.update(current_round_elapsed_time=models.F('current_round_elapsed_time') + amount, total_elapsed_time=models.F('total_elapsed_time') + amount) @@ -449,8 +449,8 @@ return "%s_%s_%s.%s" % (slugify(self.experiment_metadata.title), self.pk, datetime.now().strftime("%d-%m-%y-%H%M"), file_ext) def parameters(self, scope=None): - ps = self.experiment_metadata.parameter_set - return ps.filter(scope=scope) if scope else ps + parameter_set = self.experiment_metadata.parameter_set + return parameter_set.filter(scope=scope) if scope else parameter_set def activate(self): if not self.is_active: --- a/vcweb/core/tests.py Wed Jul 06 22:03:24 2011 -0700 +++ b/vcweb/core/tests.py Wed Jul 06 23:20:03 2011 -0700 @@ -23,7 +23,7 @@ else: experiment = self.create_new_experiment(experiment_metadata, **kwargs) if experiment.participant_set.count() == 0: - experiment.setup_test_participants(email_suffix='asu.edu') + experiment.setup_test_participants(email_suffix='asu.edu', count=10) logger.debug("loaded %s", experiment) self.experiment = experiment return experiment @@ -157,8 +157,9 @@ def test_group_allocation(self): experiment = self.experiment experiment.allocate_groups(randomize=False) + logger.debug("experiment participants is %s", experiment.participant_set.all()) self.assertEqual(experiment.group_set.count(), 2, "there should be 2 groups after non-randomized allocation") - self.assertEqual( 10, sum([group.participant_set.count() for group in experiment.group_set]) ) + self.assertEqual( 10, sum([group.participant_set.count() for group in experiment.group_set.all()]) ) def test_participant_numbering(self): experiment = self.experiment @@ -189,7 +190,7 @@ self.assertTrue(total_elapsed_time == 0) delta = 120 Experiment.objects.increment_elapsed_time(status=experiment.status, amount=delta) - experiment = self.load_experiment() + experiment = Experiment.objects.get(pk=self.experiment.pk) self.assertEqual(experiment.current_round_elapsed_time, current_round_elapsed_time + delta) self.assertEqual(experiment.total_elapsed_time, total_elapsed_time + delta) @@ -259,11 +260,13 @@ """ g = self.create_new_group(max_size=10, experiment=self.experiment) count = 0; + logger.debug("self participants: %s (%s)", self.participants, len(self.participants)) for p in self.participants: - g.add_participant(p) + g = g.add_participant(p) count += 1 - self.assertTrue(g.participant_set) - self.assertEqual(g.participant_set.count(), count, "group.participants size should be %i" % count) + if count > 10: + count = count % 10 + self.assertEqual(g.participant_set.count(), count, "group.participant_set count should be %i" % count) self.assertEqual(g.size, count, "group size should be %i" % count) http://bitbucket.org/virtualcommons/vcweb/changeset/726d04f3f6f8/ changeset: 726d04f3f6f8 user: alllee date: 2011-07-07 08:53:36 summary: fixing more tests affected #: 3 files (46 bytes) --- a/vcweb/core/models.py Wed Jul 06 23:20:03 2011 -0700 +++ b/vcweb/core/models.py Wed Jul 06 23:53:36 2011 -0700 @@ -817,7 +817,7 @@ class Meta: ordering = ['name'] - unique_together = ['name', 'experiment_metadata', 'scope'] + unique_together = ('name', 'experiment_metadata', 'scope') class ParameterizedValue(models.Model): parameter = models.ForeignKey(Parameter) --- a/vcweb/core/tests.py Wed Jul 06 23:20:03 2011 -0700 +++ b/vcweb/core/tests.py Wed Jul 06 23:53:36 2011 -0700 @@ -40,6 +40,10 @@ def experimenter(self): return self.experiment.experimenter + @property + def participants(self): + return self.experiment.participant_set.all() + def create_new_experiment(self, experiment_metadata, experimenter=None): if experimenter is None: experimenter = Experimenter.objects.get(pk=1) @@ -52,7 +56,6 @@ def setUp(self): - self.participants = Participant.objects.all() self.load_experiment() def advance_to_data_round(self): --- a/vcweb/forestry/tests.py Wed Jul 06 23:20:03 2011 -0700 +++ b/vcweb/forestry/tests.py Wed Jul 06 23:53:36 2011 -0700 @@ -237,8 +237,8 @@ def test_data_values(self): e = self.create_participant_data_values() num_participant_parameters = e.parameters(scope=Parameter.PARTICIPANT_SCOPE).count() - self.assertEqual(e.participants.count() * num_participant_parameters, ParticipantRoundDataValue.objects.filter(experiment=e).count(), - 'There should be %s participants * %s total data parameters = %s' % (e.participants.count(), num_participant_parameters, e.participants.count() * num_participant_parameters)) + self.assertEqual(e.participant_set.count() * num_participant_parameters, ParticipantRoundDataValue.objects.filter(experiment=e).count(), + 'There should be %s participants * %s total data parameters = %s' % (e.participant_set.count(), num_participant_parameters, e.participant_set.count() * num_participant_parameters)) def test_data_value_conversion(self): e = self.create_participant_data_values() http://bitbucket.org/virtualcommons/vcweb/changeset/25be79f35772/ changeset: 25be79f35772 user: alllee date: 2011-07-07 09:46:37 summary: more test fixes, need to check views as well affected #: 3 files (231 bytes) --- a/vcweb/core/models.py Wed Jul 06 23:53:36 2011 -0700 +++ b/vcweb/core/models.py Thu Jul 07 00:46:37 2011 -0700 @@ -265,7 +265,7 @@ @property def participant_group_relationships(self): - for group in self.group_set .all(): + for group in self.group_set.all(): for pgr in group.participant_group_relationship_set.all(): yield pgr @@ -938,7 +938,7 @@ vs GroupRoundDataValue.objects.filter(group_round_data=self.current_round_data, parameter=parameter).update(**update_dict) ''' - updated_rows = self.data_values.filter(round_data=self.current_round_data, parameter=parameter).update(**update_dict) + updated_rows = self.data_value_set.filter(round_data=self.current_round_data, parameter=parameter).update(**update_dict) if updated_rows != 1: logger.error("Updated %s rows, should have been only one.", updated_rows) ''' @@ -949,7 +949,7 @@ def has_data_parameter(self, **kwargs): criteria = self._data_parameter_criteria(**kwargs) try: - self.data_values.get(**criteria) + self.data_value_set.get(**criteria) return True except: return False @@ -992,9 +992,9 @@ round_data = self.current_round_data if names: if name: names.append(name) - return self.data_values.filter(round_data=round_data, parameter__name__in=names) + return self.data_value_set.filter(round_data=round_data, parameter__name__in=names) elif name: - return self.data_values.get(round_data=round_data, parameter__name=name) + return self.data_value_set.get(round_data=round_data, parameter__name=name) else: logger.warning("Trying to retrieve data value by name with no args") return None @@ -1021,9 +1021,9 @@ logger.error("Trying to transfer parameter (%s: %s) past the last round of the experiment", parameter, value) return None - next_round_data, created = self.experiment.round_data.get_or_create(round_configuration=self.experiment.next_round) + next_round_data, created = self.experiment.round_data_set.get_or_create(round_configuration=self.experiment.next_round) logger.debug("next round data: %s (%s)", next_round_data, created) - group_data_value, created = next_round_data.group_data_values.get_or_create(group=self, parameter=parameter, defaults={'value': value}) + group_data_value, created = next_round_data.group_data_value_set.get_or_create(group=self, parameter=parameter, defaults={'value': value}) logger.debug("group data value: %s (%s)", group_data_value, created) if not created: group_data_value.value = value --- a/vcweb/forestry/models.py Wed Jul 06 23:53:36 2011 -0700 +++ b/vcweb/forestry/models.py Thu Jul 07 00:46:37 2011 -0700 @@ -138,10 +138,12 @@ max_resource_level = 100 for group in experiment.group_set.all(): # FIXME: simplify logic + logger.debug("group %s has resource level", group) if has_resource_level(group): current_resource_level = get_resource_level(group) if current_round_configuration.is_playable_round: total_harvest = sum( [ hd.value for hd in get_harvest_decisions(group).all() ]) + logger.debug("total harvest for playable round: %d", total_harvest) if current_resource_level.value > 0 and total_harvest > 0: group.log("Harvest: removing %s from current resource level %s" % (total_harvest, current_resource_level.value)) set_group_harvest(group, total_harvest) --- a/vcweb/forestry/tests.py Wed Jul 06 23:53:36 2011 -0700 +++ b/vcweb/forestry/tests.py Thu Jul 07 00:46:37 2011 -0700 @@ -81,17 +81,18 @@ e.current_round_sequence_number) expected_resource_level = get_initial_resource_level(current_round_configuration) - max_harvest_decision = get_max_harvest_decision(expected_resource_level) - for pgr in e.participant_group_relationships: - self.assertEquals(get_resource_level(pgr.group).value, expected_resource_level) - set_harvest_decision(pgr, max_harvest_decision) - e.end_round() + if current_round_configuration.is_playable_round: + max_harvest_decision = get_max_harvest_decision(expected_resource_level) + for pgr in e.participant_group_relationships: + self.assertEquals(get_resource_level(pgr.group).value, expected_resource_level) + set_harvest_decision(pgr, max_harvest_decision) - if current_round_configuration.is_playable_round: expected_resource_level = calculate_expected_resource_level(expected_resource_level, max_harvest_decision * 5) + e.end_round() for group in e.group_set.all(): - self.assertEquals(get_resource_level(pgr.group).value, expected_resource_level) + logger.debug("checking group: %s", group) + self.assertEquals(get_resource_level(group).value, expected_resource_level) if e.has_next_round: e.advance_to_next_round() http://bitbucket.org/virtualcommons/vcweb/changeset/38515f4d9f88/ changeset: 38515f4d9f88 user: alllee date: 2011-07-07 10:03:20 summary: view fixes for related_name / x_set convention refactoring affected #: 7 files (132 bytes) --- a/vcweb/core/ajax.py Thu Jul 07 00:46:37 2011 -0700 +++ b/vcweb/core/ajax.py Thu Jul 07 01:03:20 2011 -0700 @@ -112,6 +112,6 @@ 'status': status_block, 'experimentData': data_block, 'active_round_number': experiment.current_round_sequence_number, - 'round_data_count': experiment.round_data.count(), + 'round_data_count': experiment.round_data_set.count(), 'error_message': error_message, }) --- a/vcweb/core/models.py Thu Jul 07 00:46:37 2011 -0700 +++ b/vcweb/core/models.py Thu Jul 07 01:03:20 2011 -0700 @@ -321,7 +321,7 @@ @property def playable_round_data(self): - return self.round_data.select_related(depth=1).filter(round_configuration__round_type__in=RoundConfiguration.PLAYABLE_ROUND_CONFIGURATIONS, + return self.round_data_set.select_related(depth=1).filter(round_configuration__round_type__in=RoundConfiguration.PLAYABLE_ROUND_CONFIGURATIONS, round_configuration__sequence_number__lte=self.current_round_sequence_number) @property @@ -908,7 +908,7 @@ @property def current_round_data_values(self): - return self.current_round_data.group_data_values + return self.current_round_data.group_data_value_set @property def is_full(self): --- a/vcweb/core/templates/experimenter/dashboard.html Thu Jul 07 00:46:37 2011 -0700 +++ b/vcweb/core/templates/experimenter/dashboard.html Thu Jul 07 01:03:20 2011 -0700 @@ -45,20 +45,18 @@ {% for e in experiments %} <div class='notice ui-corner-all'> {{e.status_line}} + <span style='float:right; padding: 3px;' class='ui-state-highlight'><b>{{e.participant_set.count}} registered participants</b></span><ul class='horizontal experiment-menu'> - <li><span style='padding: 3px;' class='ui-state-highlight'><b>{{e.participants.count}} registered participants</b></span></li><li><a title='Monitor and control this experiment' href='{{e.monitor_url}}'><img src='{{STATIC_URL}}images/famfamfam/zoom.png' alt='General experiment monitoring interface'/> monitor</a></li><li><a class='confirm-experiment-action' title='Creates a new copy of this experiment with the exact same configuration but no registered participants.' href='{{e.clone_url}}'><img src='{{STATIC_URL}}images/famfamfam/page_copy.png' alt='Clone experiment'/> clone</a></li> - {% if e.participants.count == 0 %} - {% comment %} + {% if e.participant_set.count == 0 %} <li><a title='Register participants for this experiment with actual email addresses' href='{{e.controller_url}}/register-email-list'><img src='{{STATIC_URL}}images/famfamfam/group_add.png' alt='register'/> register participants by email</a></li> - {% endcomment %} <li><a title='Register participants for this experiment with fake email addresses by providing an email suffix and the number of participants.' href='{{e.controller_url}}/register-simple'> --- a/vcweb/core/templates/experimenter/monitor.html Thu Jul 07 00:46:37 2011 -0700 +++ b/vcweb/core/templates/experimenter/monitor.html Thu Jul 07 01:03:20 2011 -0700 @@ -63,7 +63,7 @@ } $(function() { var experimentMessageDiv = document.getElementById('experiment-messages'); - registerCallbacks({{ experiment.round_data.count }}, {{ experiment.current_round.sequence_number }}); + registerCallbacks({{ experiment.round_data_set.count }}, {{ experiment.current_round.sequence_number }}); // socket.io connection // FIXME: add auth var s = connect('experimenter/{{request.user.experimenter.pk}}'); @@ -196,7 +196,7 @@ </div><div id='experimentData'> {% block data %} - {% for round_data in experiment.round_data.all reversed %} + {% for round_data in experiment.round_data_set.all reversed %} <h3><a href='#'>{{ round_data }}</a></h3><div id='round_data_{{forloop.counter}}'> {% if round_data.group_data_values.count > 0 %} --- a/vcweb/core/views.py Thu Jul 07 00:46:37 2011 -0700 +++ b/vcweb/core/views.py Thu Jul 07 01:03:20 2011 -0700 @@ -300,7 +300,7 @@ writer = unicodecsv.UnicodeWriter(response) writer.writerow(['Group', 'Members']) for group in experiment.groups.all(): - writer.writerow(itertools.chain.from_iterable([[group], group.participants.all()])) + writer.writerow(itertools.chain.from_iterable([[group], group.participant_set.all()])) for round_data in experiment.round_data.all(): round_configuration = round_data.round_configuration # write out group-wide data values @@ -338,8 +338,8 @@ current_row = 0 group_sheet.write(0, 0, 'Group') group_sheet.write(0, 1, 'Participant') - for group in experiment.groups.all(): - for participant in group.participants.all(): + for group in experiment.group_set.all(): + for participant in group.participant_set.all(): group_sheet.write(current_row, 0, group) group_sheet.write(current_row, 1, participant) current_row += 1 --- a/vcweb/forestry/templates/forestry/manage-experiment.html Thu Jul 07 00:46:37 2011 -0700 +++ b/vcweb/forestry/templates/forestry/manage-experiment.html Thu Jul 07 01:03:20 2011 -0700 @@ -14,8 +14,7 @@ <a href='#'>view data</a> | <a href='#'>download data</a></div> - {% if experiment.groups.count > 0 %} - {% for group in experiment.groups.all %} + {% for group in experiment.group_set.all %} <h3> {{ group }} </h3><div class='participants'><table> @@ -23,7 +22,7 @@ <th>Participant</th><th>Round</th><th>Parameter</th><th>Value</th></thead><tbody> - {% for participant in group.participants.all %} + {% for participant in group.participant_set.all %} {% endfor %} </tbody> @@ -37,10 +36,9 @@ {% endfor %} </ul></div> + {% empty %} + <div class='info'>Groups have not been allocated yet.</div> {% endfor %} - {% else %} - <div class='info'>Groups have not been allocated yet.</div> - {% endif %} </fieldset></p> --- a/vcweb/sanitation/templates/sanitation/configure.html Thu Jul 07 00:46:37 2011 -0700 +++ b/vcweb/sanitation/templates/sanitation/configure.html Thu Jul 07 01:03:20 2011 -0700 @@ -74,7 +74,7 @@ <th>Participant</th><th>Round</th><th>Parameter</th><th>Value</th></thead><tbody> - {% for participant in group.participants.all %} + {% for participant in group.participant_set.all %} {% endfor %} </tbody></table> Repository URL: https://bitbucket.org/virtualcommons/vcweb/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |