[virtualcommons-developer] commit/vcweb: 2 new changesets
Status: Beta
Brought to you by:
alllee
|
From: <com...@bi...> - 2013-03-19 04:14:40
|
2 new commits in vcweb: https://bitbucket.org/virtualcommons/vcweb/commits/b57b81a30fd8/ changeset: b57b81a30fd8 user: alllee date: 2013-03-19 05:12:16 summary: fixing ref errors, setting observe_other_group as an ExperimentConfiguration parameter that applies to the entire experiment as opposed to a per-round configuration parameter as it is treatment-specific: treatment A, C = observe other group treatment B, D = cannot observe other group affected #: 4 files diff -r 803f0f093db84c87d3605dd6c59e5ec2e895b8a9 -r b57b81a30fd882c0566c6fbd2472c8b8f4622525 vcweb/boundaries/models.py --- a/vcweb/boundaries/models.py +++ b/vcweb/boundaries/models.py @@ -47,8 +47,8 @@ def get_observe_other_group_parameter(): return Parameter.objects.for_round(name='observe_other_group') -def can_observe_other_group(round_configuration): - return round_configuration.get_parameter_value(parameter=get_observe_other_group_parameter(), default=False).boolean_value +def can_observe_other_group(experiment_configuration): + return experiment_configuration.get_parameter_value(parameter=get_observe_other_group_parameter(), default=False).boolean_value # players can either be dead or alive def get_player_status_dv(participant_group_relationship_id): diff -r 803f0f093db84c87d3605dd6c59e5ec2e895b8a9 -r b57b81a30fd882c0566c6fbd2472c8b8f4622525 vcweb/boundaries/tests.py --- a/vcweb/boundaries/tests.py +++ b/vcweb/boundaries/tests.py @@ -17,5 +17,3 @@ expected_parameter_names = ('survival_cost', 'storage', 'player_status') for p in ps: self.assertTrue(p.name in expected_parameter_names) - - diff -r 803f0f093db84c87d3605dd6c59e5ec2e895b8a9 -r b57b81a30fd882c0566c6fbd2472c8b8f4622525 vcweb/boundaries/views.py --- a/vcweb/boundaries/views.py +++ b/vcweb/boundaries/views.py @@ -9,7 +9,7 @@ from vcweb.boundaries.forms import HarvestDecisionForm from vcweb.boundaries.models import (get_experiment_metadata, get_regrowth_rate, get_harvest_decision_parameter, get_cost_of_living, get_resource_level, get_initial_resource_level, get_total_storage, get_storage, - get_last_harvest_decision) + get_last_harvest_decision, can_observe_other_group) import logging import random @@ -65,7 +65,7 @@ cost_of_living = get_cost_of_living(current_round) own_group = participant_group_relationship.group own_resource_level = 0 - last_harvest_decision = get_last_harvest_decision(pgr, round_data=previous_round_data) + last_harvest_decision = get_last_harvest_decision(participant_group_relationship, round_data=previous_round_data) experiment_model_dict['playerData'] = [{ 'id': pgr.participant_number, 'lastHarvestDecision': last_harvest_decision, @@ -97,8 +97,8 @@ experiment_model_dict['roundType'] = current_round.round_type experiment_model_dict['regrowthRate'] = regrowth_rate experiment_model_dict['costOfLiving'] = cost_of_living - experiment_model_dict['participantNumber'] = pgr.participant_number - experiment_model_dict['participantGroupId'] = pgr.pk + experiment_model_dict['participantNumber'] = participant_group_relationship.participant_number + experiment_model_dict['participantGroupId'] = participant_group_relationship.pk experiment_model_dict['dollarsPerToken'] = ec.exchange_rate experiment_model_dict['chatEnabled'] = round_configuration.chat_enabled # FIXME: defaults hard coded in for now @@ -106,7 +106,7 @@ experiment_model_dict['warningCountdownTime'] = 10 experiment_model_dict['lastHarvestDecision'] = last_harvest_decision - experiment_model_dict['storage'] = get_storage(pgr, current_round_data) + experiment_model_dict['storage'] = get_storage(participant_group_relationship, current_round_data) experiment_model_dict['resourceLevel'] = own_resource_level # FIXME: these need to be looked up experiment_model_dict['maxHarvestDecision'] = 10 diff -r 803f0f093db84c87d3605dd6c59e5ec2e895b8a9 -r b57b81a30fd882c0566c6fbd2472c8b8f4622525 vcweb/core/models.py --- a/vcweb/core/models.py +++ b/vcweb/core/models.py @@ -215,13 +215,13 @@ def get_parameter_value(self, parameter=None, name=None, default=None): if parameter is None and name is None: logger.error("Can't find a parameter value with no name or parameter, returning default") - return default + return DefaultValue(default) try: if parameter: return self.experiment_parameter_value_set.get(parameter=parameter) elif name: return self.experiment_parameter_value_set.get(parameter__name=name) - except ExperimentParameterValue.DoesNotExist: + except ExperimentParameterValue.DoesNotExist as e: logger.debug("no experiment configuration parameter value found: (%s, %s) returning default %s", parameter, name, default) return DefaultValue(default) https://bitbucket.org/virtualcommons/vcweb/commits/658e0da29ff7/ changeset: 658e0da29ff7 user: alllee date: 2013-03-19 05:14:24 summary: adding group shared resource experiment configuration parameter affected #: 1 file diff -r b57b81a30fd882c0566c6fbd2472c8b8f4622525 -r 658e0da29ff738092655dd2384d3136d769bcb0b vcweb/boundaries/models.py --- a/vcweb/boundaries/models.py +++ b/vcweb/boundaries/models.py @@ -45,7 +45,11 @@ @simplecache def get_observe_other_group_parameter(): - return Parameter.objects.for_round(name='observe_other_group') + return Parameter.objects.for_experiment(name='observe_other_group') + +@simplecache +def get_shared_resource_parameter(): + return Parameter.objects.for_experiment(name='shared_resource') def can_observe_other_group(experiment_configuration): return experiment_configuration.get_parameter_value(parameter=get_observe_other_group_parameter(), default=False).boolean_value 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. |