From c1843ff9633365af417b9b041f6766e81071fab2 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Sun, 8 Nov 2020 14:50:19 +0100 Subject: [PATCH 1/5] Lint: Catch StandardError during assess --- lib/assessor.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/assessor.rb b/lib/assessor.rb index 910b5939..c237a5cf 100644 --- a/lib/assessor.rb +++ b/lib/assessor.rb @@ -4,7 +4,7 @@ class Assessor def assess(output) test_outcome = @testing_framework_adapter.test_outcome(output) test_outcome.merge(score: calculate_score(test_outcome)) - rescue + rescue StandardError {score: 0} end From c2a816968ed7567fb0b1b327f92687493a88b7b6 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Sun, 8 Nov 2020 14:53:50 +0100 Subject: [PATCH 2/5] Show no run output for Python execenv --- app/controllers/submissions_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/submissions_controller.rb b/app/controllers/submissions_controller.rb index 7035de30..fff49cc3 100644 --- a/app/controllers/submissions_controller.rb +++ b/app/controllers/submissions_controller.rb @@ -220,7 +220,9 @@ class SubmissionsController < ApplicationController # save the output of this "run" as a "testrun" (scoring runs are saved in submission_scoring.rb) save_run_output - if @run_output.blank? + # For Python containers, the @run_output is '{"cmd":"exit"}' as a string. + # If this is the case, we should consider it as blank + if @run_output.blank? || @run_output&.strip == '{"cmd":"exit"}' @raw_output ||= '' @run_output ||= '' parse_message t('exercises.implement.no_output', timestamp: l(Time.now, format: :short)), 'stdout', tubesock From ad2616bdb42b379bf6f34abcc76a6829f38f8268 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Sun, 8 Nov 2020 15:04:49 +0100 Subject: [PATCH 3/5] Add info about webpack-dev-server --- docs/LOCAL_SETUP.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/LOCAL_SETUP.md b/docs/LOCAL_SETUP.md index 7cc69d4f..8ceae0c0 100644 --- a/docs/LOCAL_SETUP.md +++ b/docs/LOCAL_SETUP.md @@ -165,3 +165,13 @@ admin@example.org:admin ```shell script rails s ``` + +## Webpack + +This project uses `webpacker` to integrate Webpack with Rails to deliver Frontend assets. During development, the `webpack-dev-server` automatically launches togehter with the Rails server if not specified otherwise. In case of missing JavaScript or stylesheets or for hot reloading in the browser, you might want to start the `webpack-dev-server` manually *before starting Rails*: + +```shell script +./bin/webpack-dev-server +``` + +This will launch a dedicated server on port 3035 (default setting) and allow incoming WebSocket connections from your browser. From 902e1e46da488950f0af8fb03f37d3a6c32452ee Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Sun, 8 Nov 2020 15:15:00 +0100 Subject: [PATCH 4/5] Allow linter for exercises 3.1.X in Python course --- lib/python20_course_week.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/python20_course_week.rb b/lib/python20_course_week.rb index 420c40b9..11afd4a1 100644 --- a/lib/python20_course_week.rb +++ b/lib/python20_course_week.rb @@ -8,7 +8,13 @@ class Python20CourseWeek 1 when /Python20 Aufgabe 2/ 2 - when /Python20 Aufgabe 3/ + when /Python20 Aufgabe 3.1/ + nil # Explicitly enable everything (linter + tips if available)! + when /Python20 Aufgabe 3.2/ + 3 + when /Python20 Aufgabe 3.3/ + 3 + when /Python20 Aufgabe 3.4/ 3 when /Python20 Aufgabe 4/ 4 From e958b890cfa09e837e0392456ae8cbf7faa4a798 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Mon, 9 Nov 2020 00:01:44 +0100 Subject: [PATCH 5/5] Prevent code duplication when changing from implement view --- app/assets/javascripts/editor/editor.js.erb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/assets/javascripts/editor/editor.js.erb b/app/assets/javascripts/editor/editor.js.erb index 4b4c8810..2c0696e4 100644 --- a/app/assets/javascripts/editor/editor.js.erb +++ b/app/assets/javascripts/editor/editor.js.erb @@ -833,8 +833,7 @@ var CodeOceanEditor = { this.initializeDeadlines(); CodeOceanEditorTips.initializeEventHandlers(); - window.addEventListener("beforeunload", this.unloadAutoSave.bind(this)); - window.addEventListener("page:before-change", this.unloadAutoSave.bind(this)); + window.addEventListener("turbolinks:request-start", this.unloadAutoSave.bind(this)); // create autosave when the editor is opened the first time this.autosave(); }