[virtualcommons-developer] commit/vcweb: alllee: patching number_of_ready_participants some more,
Status: Beta
Brought to you by:
alllee
|
From: <com...@bi...> - 2013-03-25 22:57:22
|
1 new commit in vcweb: https://bitbucket.org/virtualcommons/vcweb/commits/45b6aa258a7b/ Changeset: 45b6aa258a7b User: alllee Date: 2013-03-25 23:57:24 Summary: patching number_of_ready_participants some more, should be based on whether or not a round is in progress, not just active Affected #: 1 file diff -r 89b9e73f241bd887d264dc1e466d36d40b279487 -r 45b6aa258a7b3a508f4ecbe242b39d40e81222f1 vcweb/core/models.py --- a/vcweb/core/models.py +++ b/vcweb/core/models.py @@ -516,7 +516,7 @@ @property def number_of_ready_participants(self): - if self.is_active: + if self.is_round_in_progress: return ParticipantRoundDataValue.objects.filter(parameter=get_participant_ready_parameter(), round_data=self.current_round_data, boolean_value=True).count() else: return 0 @@ -768,16 +768,6 @@ self.current_round_sequence_number = max(self.current_round_sequence_number - 1, 1) self.save() - def move_to_next_round(self): - if self.is_round_in_progress: - self.end_round() - if self.has_next_round: - self.current_round_elapsed_time = 0 - self.current_round_sequence_number += 1 - return True - else: - logger.warning("trying to advance past the last round - no-op") - def invoke(self, action_name): if action_name in ('advance_to_next_round', 'end_round', 'start_round', 'activate', 'deactivate', 'complete'): getattr(self, action_name)() @@ -785,8 +775,14 @@ raise AttributeError("Invalid experiment action %s requested of experiment %s" % (action_name, self)) def advance_to_next_round(self): - if self.move_to_next_round(): + if self.is_round_in_progress: + self.end_round() + if self.has_next_round: + self.current_round_elapsed_time = 0 + self.current_round_sequence_number += 1 self.start_round() + else: + logger.warning("trying to advance past the last round - no-op") def create_round_data(self): round_data, created = self.round_data_set.get_or_create(round_configuration=self.current_round) 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. |