fix points rounding in results view, clear results view on new scoring attempt.

This commit is contained in:
Ralf Teusner
2016-12-19 18:29:33 +01:00
parent f82737a7d4
commit a03d604861
2 changed files with 11 additions and 2 deletions

View File

@ -351,7 +351,7 @@ configureEditors: function () {
},
isBrowserSupported: function () {
// websockets is used for run, score and test
// websockets are used for run, score and test
return Modernizr.websockets;
},
@ -361,7 +361,7 @@ configureEditors: function () {
panel.find('.panel-title .number').text(index + 1);
panel.find('.row .col-sm-9').eq(0).find('.number').eq(0).text(result.passed);
panel.find('.row .col-sm-9').eq(0).find('.number').eq(1).text(result.count);
panel.find('.row .col-sm-9').eq(1).find('.number').eq(0).text((result.score * result.weight).toFixed(2));
panel.find('.row .col-sm-9').eq(1).find('.number').eq(0).text(parseFloat((result.score * result.weight).toFixed(2)));
panel.find('.row .col-sm-9').eq(1).find('.number').eq(1).text(result.weight);
panel.find('.row .col-sm-9').eq(2).text(result.message);
if (result.error_messages) panel.find('.row .col-sm-9').eq(3).text(result.error_messages.join(', '));

View File

@ -6,6 +6,7 @@ CodeOceanEditorEvaluation = {
*/
scoreCode: function (event) {
event.preventDefault();
this.clearScoringOutput();
this.createSubmission('#assess', null, function (response) {
this.showSpinner($('#assess'));
$('#score_div').removeClass('hidden');
@ -139,6 +140,14 @@ CodeOceanEditorEvaluation = {
$('#output pre').remove();
},
clearScoringOutput: function() {
$('#results ul').first().html('');
$('.test-count .number').html(0);
$('#score').data('score', 0);
this.renderScore();
this.clearOutput();
},
printOutput: function (output, colorize, index) {
var element = this.findOrCreateOutputElement(index);
if (!colorize) {