[virtualcommons-developer] commit/vcweb: alllee: adding participant experiment relationship back fo
Status: Beta
Brought to you by:
alllee
|
From: <com...@bi...> - 2013-03-19 07:10:17
|
1 new commit in vcweb: https://bitbucket.org/virtualcommons/vcweb/commits/20d7401e0ff8/ changeset: 20d7401e0ff8 user: alllee date: 2013-03-19 08:09:57 summary: adding participant experiment relationship back for sockjs connectivity affected #: 3 files diff -r 69282ad0b5f9fb3882ed224cd6c15106ab0f8875 -r 20d7401e0ff852fe5becdbee8d9cd8d792610972 vcweb/boundaries/views.py --- a/vcweb/boundaries/views.py +++ b/vcweb/boundaries/views.py @@ -28,6 +28,7 @@ return render_to_response('boundaries/participate.html', { 'auth_token': participant.authentication_token, 'experiment': experiment, + 'participant_experiment_relationship': experiment.get_participant_experiment_relationship(participant) 'participant_group_relationship': pgr, 'experimentModelJson': get_view_model_json(experiment, pgr), }, diff -r 69282ad0b5f9fb3882ed224cd6c15106ab0f8875 -r 20d7401e0ff852fe5becdbee8d9cd8d792610972 vcweb/core/models.py --- a/vcweb/core/models.py +++ b/vcweb/core/models.py @@ -450,7 +450,7 @@ @property def playable_round_data(self): - return self.round_data_set.select_related(depth=1).filter(round_configuration__round_type__in=RoundConfiguration.PLAYABLE_ROUND_CONFIGURATIONS, + return self.round_data_set.select_related('experiment', 'round_configuration').filter(round_configuration__round_type__in=RoundConfiguration.PLAYABLE_ROUND_CONFIGURATIONS, round_configuration__sequence_number__lte=self.current_round_sequence_number) @property @@ -523,6 +523,9 @@ def all_participants_ready(self): return self.ready_participants >= self.participant_set.count() + def get_participant_experiment_relationship(self, participant): + return self.participant_relationship_set.get(participant=participant) + def get_participant_group_relationship(self, participant): session_id = self.current_round.session_id if session_id is None: @@ -1592,6 +1595,8 @@ birthdate = models.DateField(null=True, blank=True) address = models.ForeignKey(Address, null=True, blank=True) + ''' + FIXME: move these into a ParticipantQuerySet with PassThroughManager if needed @property def active_experiments(self): return self.experiment_relationship_set.filter(experiment__status=Experiment.Status.ACTIVE) @@ -1604,14 +1609,9 @@ def completed_experiments(self): return self.experiments_with_status(Experiment.Status.COMPLETED) - def get_participant_experiment_relationship(self, experiment): - return ParticipantExperimentRelationship.objects.select_related(depth=1).get(participant=self, experiment=experiment) - - def get_participant_group_relationship(self, experiment): - return ParticipantGroupRelationship.objects.get_relationship(self, experiment) - def experiments_with_status(self, status=Experiment.Status.ACTIVE): return self.experiment_relationship_set.filter(experiment__status=status) + ''' class Meta: ordering = ['user'] diff -r 69282ad0b5f9fb3882ed224cd6c15106ab0f8875 -r 20d7401e0ff852fe5becdbee8d9cd8d792610972 vcweb/vcweb-sockjs.py --- a/vcweb/vcweb-sockjs.py +++ b/vcweb/vcweb-sockjs.py @@ -163,7 +163,7 @@ ''' def connections(self, group): experiment = group.experiment - for participant_group_relationship in group.participant_group_relationship_set.select_related(depth=1).all(): + for participant_group_relationship in group.participant_group_relationship_set.select_related('participant').all(): ''' only return currently connected connections in this group ''' participant = participant_group_relationship.participant participant_tuple = (participant.pk, experiment.pk) 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. |