diff --git a/Gemfile.lock b/Gemfile.lock index 3e7dd174..cbebab3f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -110,7 +110,7 @@ GEM excon (>= 0.38.0) json erubis (2.7.0) - excon (0.44.4) + excon (0.45.0) execjs (2.4.0) factory_girl (4.5.0) activesupport (>= 3.0.0) diff --git a/app/assets/javascripts/editor.js b/app/assets/javascripts/editor.js index 184e1043..7ec977a1 100644 --- a/app/assets/javascripts/editor.js +++ b/app/assets/javascripts/editor.js @@ -569,10 +569,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) { @@ -734,10 +741,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'], @@ -755,6 +759,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); diff --git a/config/locales/de.yml b/config/locales/de.yml index 1410ec5f..e44da63a 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -180,7 +180,7 @@ de: stop: Stoppen submit: Code zur Bewertung abgeben test: Testen - timeout: 'Ihr Code benötigte länger als die erlaubten %{permitted_execution_time} Sekunden, um zu terminieren.' + timeout: 'Ihr Code hat die erlaubte Ausführungszeit von %{permitted_execution_time} Sekunden überschritten.' tooltips: save: Ihr Code wird automatisch gespeichert, wann immer Sie eine Datei herunterladen, ausführen oder testen. Explizites Speichern ist also selten notwendig. editor_file_tree: diff --git a/config/locales/en.yml b/config/locales/en.yml index bfcf49fe..4ee929ec 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -180,7 +180,7 @@ en: stop: Stop submit: Submit Code For Assessment test: Test - timeout: 'Your code took longer than the permitted %{permitted_execution_time} seconds to run.' + timeout: 'Your code exceeded the permitted execution time of %{permitted_execution_time} seconds.' tooltips: save: Your code is automatically saved whenever you download, run, or test it. Therefore, explicitly saving is rarely necessary. editor_file_tree: diff --git a/lib/assets/javascripts/flash.js b/lib/assets/javascripts/flash.js index 412e74e1..cd5cb72d 100644 --- a/lib/assets/javascripts/flash.js +++ b/lib/assets/javascripts/flash.js @@ -5,11 +5,7 @@ var buildFlash = function(options) { if (options.text) { var container = options.container; - var html = ''; - if (options.icon) { - html += ' '; - } - html += options.text; + var html = (options.icon ? '' : '') + options.text; container.html(html); showFlashes(); }