diff --git a/app/assets/javascripts/editor.js b/app/assets/javascripts/editor.js index 33b57d8d..4187bb4a 100644 --- a/app/assets/javascripts/editor.js +++ b/app/assets/javascripts/editor.js @@ -394,10 +394,17 @@ $(function() { $('#results ul').first().html(''); $('.test-count .number').html(response.length); clearOutput(); + _.each(response, function(result, index) { printOutput(result, false, index); printScoringResult(result, index); }); + + if (_.some(response, function(result) { + return result.status === 'timeout'; + })) { + showTimeoutMessage(); + } }; var renderCode = function(event) { @@ -559,10 +566,7 @@ $(function() { var showStatus = function(output) { if (output.status === 'timeout') { - $.flash.danger({ - icon: ['fa', 'fa-clock-o'], - text: $('#editor').data('message-timeout') - }); + showTimeoutMessage(); } else if (output.stderr) { $.flash.danger({ icon: ['fa', 'fa-bug'], @@ -580,6 +584,13 @@ $(function() { $('a[data-toggle="tab"]').eq(index || 0).tab('show'); }; + var showTimeoutMessage = function() { + $.flash.danger({ + icon: ['fa', 'fa-clock-o'], + text: $('#editor').data('message-timeout') + }); + }; + var showWorkspaceTab = function(event) { event.preventDefault(); showTab(1);