[virtualcommons-developer] commit/vcweb: alllee: setting logs properly
Status: Beta
Brought to you by:
alllee
From: <com...@bi...> - 2013-03-27 10:14:56
|
1 new commit in vcweb: https://bitbucket.org/virtualcommons/vcweb/commits/6fed7a80dc3e/ Changeset: 6fed7a80dc3e User: alllee Date: 2013-03-27 11:14:34 Summary: setting logs properly Affected #: 5 files diff -r dafca79ec5983354784a555c021a739fd07d17de -r 6fed7a80dc3ef56617679869a3c9f5d788908745 vcweb/boundaries/models.py --- a/vcweb/boundaries/models.py +++ b/vcweb/boundaries/models.py @@ -204,7 +204,6 @@ # reset all player statuses to True ParticipantRoundDataValue.objects.for_group(group, parameter=get_player_status_parameter(), round_data=round_data).update(boolean_value=True) - # FIXME: start server side timer def get_total_harvest(group, round_data): diff -r dafca79ec5983354784a555c021a739fd07d17de -r 6fed7a80dc3ef56617679869a3c9f5d788908745 vcweb/boundaries/templates/boundaries/participate.html --- a/vcweb/boundaries/templates/boundaries/participate.html +++ b/vcweb/boundaries/templates/boundaries/participate.html @@ -446,11 +446,13 @@ model.startRound = function() { console.debug("starting round"); model.enableChat(); - model.secondsLeft(model.timeRemaining()); - model.setCurrentInterval( + var intRegex = /^\d+$/; + if (intRegex.test(model.timeRemaining()) && model.timeRemaining() > 0) { + model.secondsLeft(model.timeRemaining()); + model.setCurrentInterval( setInterval(function() { model.tick(); - if (model.secondsLeft() == 30) { + if (model.secondsLeft() == 30 && !model.submitted()) { model.setFormDisabled("#vcweb-form", false); } if (! model.isTimerRunning()) { @@ -460,8 +462,10 @@ } }, 1000)); + } }; model.submitDecision = function(data, evt) { + model.setFormDisabled("#vcweb-form", false); var formData = $('#vcweb-form').serialize(); model.setFormDisabled("#vcweb-form", true); model.setFormDisabled("#chat-form", true); diff -r dafca79ec5983354784a555c021a739fd07d17de -r 6fed7a80dc3ef56617679869a3c9f5d788908745 vcweb/boundaries/views.py --- a/vcweb/boundaries/views.py +++ b/vcweb/boundaries/views.py @@ -37,7 +37,7 @@ pgr = get_object_or_404(ParticipantGroupRelationship, pk=participant_group_id) harvest_decision = form.cleaned_data['integer_decision'] set_harvest_decision(pgr, harvest_decision, experiment.current_round_data, submitted=True) - message = "harvested %s trees" % harvest_decision + message = "%s harvested %s trees" % (pgr.participant, harvest_decision) experiment.log(message) return JsonResponse(dumps({ 'success': True, 'experimentModelJson': get_view_model_json(experiment, pgr), 'message': message})) diff -r dafca79ec5983354784a555c021a739fd07d17de -r 6fed7a80dc3ef56617679869a3c9f5d788908745 vcweb/core/templates/experimenter/monitor.html --- a/vcweb/core/templates/experimenter/monitor.html +++ b/vcweb/core/templates/experimenter/monitor.html @@ -111,10 +111,12 @@ </div></div><div class='span6'> - <h4>Experiment Log</h4> - <div id='experiment-messages' class='alert' data-bind='foreach: messages'> - <div> - <span data-bind='text: $data'></span> + <div style='padding-right: 8px;' class='alert alert-messages'> + <h4>EXPERIMENT LOG</h4> + <div id='experiment-messages' data-bind='foreach: messages'> + <div> + <span data-bind='text: $data'></span> + </div></div></div> {% comment %} @@ -321,7 +323,16 @@ var s = connect("/experimenter"); s.onmessage = function(evt) { console.log("Received event: " + evt); - experimentModel.addMessage(jQuery.parseJSON(evt.data)); + experiment_event = $.parseJSON(evt.data); + switch (experiment_event.event_type) { + case 'chat': + experimentModel.addMessage("Participant " + experiment_event.participant_number + ": " + experiment_event.message); + break; + case 'info': + default: + experimentModel.addMessage(experiment_event.message); + break; + } }; return experimentModel; // FIXME: this won't quite work diff -r dafca79ec5983354784a555c021a739fd07d17de -r 6fed7a80dc3ef56617679869a3c9f5d788908745 vcweb/static/css/style.css --- a/vcweb/static/css/style.css +++ b/vcweb/static/css/style.css @@ -82,7 +82,10 @@ margin-bottom: 10px; } #experiment-messages { - height: 230px; + height: 280px; + width: auto; + padding: 5px 0px 5px 0px; + margin: 5px 0px 5px 0px; overflow: auto; } .left-divider { 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. |