[virtualcommons-svn] commit/vcweb: alllee: adding delay to harvest decision submission, minor impro
Status: Beta
Brought to you by:
alllee
From: Bitbucket <com...@bi...> - 2011-06-22 07:48:37
|
1 new changeset in vcweb: http://bitbucket.org/virtualcommons/vcweb/changeset/f1d5f9de1513/ changeset: f1d5f9de1513 user: alllee date: 2011-06-22 09:48:27 summary: adding delay to harvest decision submission, minor improvements to logging in preparation for pretest tomorrow affected #: 6 files (346 bytes) --- a/vcweb/core/models.py Tue Jun 21 23:55:22 2011 -0700 +++ b/vcweb/core/models.py Wed Jun 22 00:48:27 2011 -0700 @@ -694,7 +694,7 @@ return Template(template_string).substitute(kwargs, round_number=self.display_number, participant_id=participant_id) def __unicode__(self): - return u"%s > %s %s" % (self.display_label, self.experiment_configuration, self.sequence_label) + return u"%s (%s)" % (self.display_label, self.sequence_label) @property def display_label(self): @@ -1043,7 +1043,7 @@ next_round_data, created = self.experiment.round_data.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}) - logger.debug("%s (%s)", group_data_value, created) + logger.debug("group data value: %s (%s)", group_data_value, created) if not created: group_data_value.value = value group_data_value.save() --- a/vcweb/core/templates/base-vcweb-form.html Tue Jun 21 23:55:22 2011 -0700 +++ b/vcweb/core/templates/base-vcweb-form.html Wed Jun 22 00:48:27 2011 -0700 @@ -6,7 +6,7 @@ {% endblock head %} {% block page %} -<form id='vcweb-form' action='.' method='post'> +<form id='vcweb-form' action='' method='post'> {% csrf_token %} {% block form %} --- a/vcweb/core/templates/experimenter/monitor.html Tue Jun 21 23:55:22 2011 -0700 +++ b/vcweb/core/templates/experimenter/monitor.html Wed Jun 22 00:48:27 2011 -0700 @@ -158,8 +158,13 @@ <li><a class='confirm-experiment-action' name='end_round' href='end-round' title='Stops the current round.'><span class='vcweb-icon icon-left ui-icon' style='background: url({{STATIC_URL}}images/famfamfam/control_stop_blue.png);' ></span>end round</a></li> {% else %} + {% comment %} + FIXME: disabling for the time being, I have a suspicion Veronika + might be clicking it accidentally and redoing rounds (thus + applying group harvest + regrowth twice) <li><a class='confirm-experiment-action' name='start_round' href='start-round' title='Starts the round.'><span class='ui-icon vcweb-icon icon-left' style='background:url({{STATIC_URL}}images/famfamfam/control_play_blue.png);' ></span>start round</a></li> + {% endcomment %} {% endif %} <li><a class='confirm-experiment-action' name='advance_to_next_round' href='advance-to-next-round' title='Stops the current round if necessary and advances to the next round.'><span class='vcweb-icon ui-icon icon-left' style='background:url({{STATIC_URL}}images/famfamfam/control_fastforward_blue.png);' ></span>advance to next round</a></li> @@ -252,11 +257,6 @@ <a class='dark-yellow-highlight' name='{{chat_message.pk}}' title='{{chat_message.date_created}} {{chat_message.participant}}'> {{chat_message.date_created|date:"G:i:s"}}</a> | {{chat_message}} </div> - {% empty %} - <div class='ui-state-highlight' style='line-height: 1.5em;'> - <span class='ui-icon ui-icon-info vcweb-icon'></span> - <span class='dark-yellow-highlight'>{% now "G:i:s" %}</span> | No chat messages have been sent yet. - </div> {% endfor %} </div></div> --- a/vcweb/forestry/models.py Tue Jun 21 23:55:22 2011 -0700 +++ b/vcweb/forestry/models.py Wed Jun 22 00:48:27 2011 -0700 @@ -99,8 +99,8 @@ group.set_data_value(parameter=get_resource_level_parameter(), value=value) def round_setup(experiment, **kwargs): - logger.debug(experiment) round_configuration = experiment.current_round + logger.debug("current round %s", round_configuration) if round_configuration.is_playable_round: # participant parameter harvest_decision_parameter = get_harvest_decision_parameter() @@ -133,8 +133,8 @@ calculates new resource levels for practice or regular rounds based on the group harvest and resultant regrowth. also responsible for transferring those parameters to the next round as needed. ''' - logger.debug(experiment) current_round_configuration = experiment.current_round + logger.debug("current round: %s", current_round_configuration) max_resource_level = 100 for group in experiment.groups.all(): # FIXME: simplify logic @@ -174,7 +174,6 @@ forestry_sender = 1 @receiver(signals.round_started, sender=forestry_sender) def round_started_handler(sender, experiment=None, **kwargs): - logger.debug("forestry handling round started signal") round_setup(experiment, **kwargs) @receiver(signals.round_ended, sender=forestry_sender) --- a/vcweb/forestry/templates/forestry/participate.html Tue Jun 21 23:55:22 2011 -0700 +++ b/vcweb/forestry/templates/forestry/participate.html Wed Jun 22 00:48:27 2011 -0700 @@ -37,31 +37,26 @@ var harvestDecisionValue = $('#harvest-decision-id').val(); // FIXME: this isn't getting sent through properly before the submit occurs. // Should work out communicating directly from Django to the tornadio process. + $('#submit').attr('disabled', true); s.send(createSubmitEvent(harvestDecisionValue)); - return true; + $('#forestry-form').delay(500).submit(); + return false; }); */ - $('#submit').click(function() { + $('#submit-harvest').click(function() { var harvestDecisionValue = $('#harvest-decision-id').val(); + $('#submit-harvest').attr('disabled', true); s.send(createSubmitEvent(harvestDecisionValue)); - $('#submit').disable(); - $('#submitDialog').dialog({modal: true}); - $(this).fastConfirm({ - questionText: "Submit your harvest decision of " + harvestDecisionValue + "?", - onProceed: function(trigger) { - $('#forestry-form').submit(); - $(trigger).fastConfirm('close'); - }, - onCancel: function(trigger) { - $(trigger).fastConfirm('close'); - } - }); + setTimeout(function() { + $('#forestry-form').submit(); + }, 300); + return true; }); }); </script> {% endblock %} {% block title %} -Participating in {{experiment.status_line}} +{{ experiment.status_line }} {% endblock %} {% block content %} <h3>Forestry round number {{ experiment.current_round.round_number }}</h3> @@ -101,7 +96,7 @@ <input id='harvest-decision-id' style='width: 2em; text-align: right;' type="text" name='harvest_decision' class='required digits' maxlength='1'/></div><div> - <button id='submit' type='submit'>Harvest</button> + <button id='submit-harvest' type='submit'>Harvest</button></div></form> {% else %} --- a/vcweb/forestry/views.py Tue Jun 21 23:55:22 2011 -0700 +++ b/vcweb/forestry/views.py Wed Jun 22 00:48:27 2011 -0700 @@ -72,6 +72,7 @@ for round_data in experiment.playable_round_data: logger.debug("generating participant history for %s", round_data) data = ParticipantRoundData() +# FIXME: this kind of binding is a bit laborious and error-prone, refactor if possible data.round_configuration = round_data.round_configuration data.individual_harvest = get_harvest_decision(participant_group_relationship, round_data=round_data) data.group_harvest = get_group_harvest(group, round_data=round_data) 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. |