From 3dd27ef915f18e1048b57cdb9e81e32790f2b73e Mon Sep 17 00:00:00 2001 From: Hauke Klement Date: Fri, 27 Mar 2015 09:29:47 +0100 Subject: [PATCH 1/4] updated bundle --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 74816ff4..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) @@ -247,7 +247,7 @@ GEM rainbow (>= 1.99.1, < 3.0) ruby-progressbar (~> 1.4) rubocop-rspec (1.2.2) - ruby-progressbar (1.7.4) + ruby-progressbar (1.7.5) rubytree (0.9.4) json (~> 1.8) structured_warnings (~> 0.1) From 5bb4f192c01449cd1826ec7f5cf56a7623049866 Mon Sep 17 00:00:00 2001 From: Hauke Klement Date: Fri, 27 Mar 2015 09:33:00 +0100 Subject: [PATCH 2/4] fixed markup of flash messages --- lib/assets/javascripts/flash.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) 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(); } From d4660b26594ee93a7f3e596a596bb47d4067070d Mon Sep 17 00:00:00 2001 From: Hauke Klement Date: Fri, 27 Mar 2015 09:37:20 +0100 Subject: [PATCH 3/4] changed flash message text --- config/locales/de.yml | 2 +- config/locales/en.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/de.yml b/config/locales/de.yml index c128ce56..f75b5405 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 847886cb..1389fb4c 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: From 780f6a4fa60b823c639c43d5c8fa811b935352fe Mon Sep 17 00:00:00 2001 From: Hauke Klement Date: Fri, 27 Mar 2015 09:41:58 +0100 Subject: [PATCH 4/4] show flash message if permitted execution time is exceeded during test execution --- app/assets/javascripts/editor.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) 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);