From 68d3bf80b59f68287f378dae034d0d1f972e223a Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Tue, 27 Feb 2018 18:05:38 +0100 Subject: [PATCH 1/7] Fix chosen form width to allow a larger form for long list entries Signed-off-by: Sebastian Serth --- app/assets/stylesheets/forms.css.scss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/forms.css.scss b/app/assets/stylesheets/forms.css.scss index 201b5841..69c1722c 100644 --- a/app/assets/stylesheets/forms.css.scss +++ b/app/assets/stylesheets/forms.css.scss @@ -3,7 +3,8 @@ } .chosen-container { - width: 250px !important; + min-width: 250px !important; + width: 100% !important; } .code-field { From 1004acd1d5256980fffc5f165cb7fc8518b5afc1 Mon Sep 17 00:00:00 2001 From: Ralf Teusner Date: Thu, 1 Mar 2018 16:09:29 +0100 Subject: [PATCH 2/7] allow numbers to be passed via std.in (numbers are valid json, but crashed when we tried to access them in a hash way. This is now prevented.) --- app/controllers/submissions_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/submissions_controller.rb b/app/controllers/submissions_controller.rb index 3e24af1c..b6d7052f 100644 --- a/app/controllers/submissions_controller.rb +++ b/app/controllers/submissions_controller.rb @@ -167,7 +167,7 @@ class SubmissionsController < ApplicationController # if the command is 'client_kill', send it to docker otherwise. begin parsed = JSON.parse(data) - if parsed['cmd'] == 'client_kill' + if parsed.class == Hash && parsed['cmd'] == 'client_kill' Rails.logger.debug("Client exited container.") @docker_client.kill_container(result[:container]) else From c74fa1e9e48a3b022f33b20f96fe1af6af0b0391 Mon Sep 17 00:00:00 2001 From: Ralf Teusner Date: Thu, 1 Mar 2018 19:08:25 +0100 Subject: [PATCH 3/7] add deprecated_finders --- Gemfile | 1 + Gemfile.lock | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Gemfile b/Gemfile index e71bead4..8482ca69 100644 --- a/Gemfile +++ b/Gemfile @@ -7,6 +7,7 @@ gem 'carrierwave' gem 'coffee-rails' gem 'concurrent-ruby' gem 'concurrent-ruby-ext', platform: :ruby +gem 'activerecord-deprecated_finders', require: 'active_record/deprecated_finders' gem 'docker-api', require: 'docker' gem 'factory_bot_rails' gem 'forgery' diff --git a/Gemfile.lock b/Gemfile.lock index 8b3c2dbc..43737a82 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -31,6 +31,7 @@ GEM activemodel (= 4.2.10) activesupport (= 4.2.10) arel (~> 6.0) + activerecord-deprecated_finders (1.0.4) activerecord-jdbc-adapter (50.0) activerecord (>= 2.2) activerecord-jdbcpostgresql-adapter (50.0) @@ -388,6 +389,7 @@ PLATFORMS ruby DEPENDENCIES + activerecord-deprecated_finders activerecord-jdbcpostgresql-adapter autotest-rails bcrypt From 9d3167fe2c9f21204870431661af6d3460a8901e Mon Sep 17 00:00:00 2001 From: Ralf Teusner Date: Thu, 1 Mar 2018 19:14:46 +0100 Subject: [PATCH 4/7] remove errornous line of code --- app/views/sessions/destroy_through_lti.html.slim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/sessions/destroy_through_lti.html.slim b/app/views/sessions/destroy_through_lti.html.slim index 3e55e0fc..d33ced8d 100644 --- a/app/views/sessions/destroy_through_lti.html.slim +++ b/app/views/sessions/destroy_through_lti.html.slim @@ -10,7 +10,7 @@ h2 = t('shared.statistics') = row(label: '.score') do p == t('shared.out_of', maximum_value: @submission.exercise.maximum_score, value: @submission.score) p = progress_bar(@submission.percentage) -= row(label: '.final_submissions', value: @submission.exercise.submissions.final.distinct.count(:user_id, :user_type) - 1) +/= row(label: '.final_submissions', value: @submission.exercise.submissions.final.distinct.count(:user_id, :user_type) - 1) /= row(label: '.average_score') do / p == t('shared.out_of', maximum_value: @submission.exercise.maximum_score, value: @submission.exercise.average_score.round(2)) / p = progress_bar(@submission.exercise.average_percentage) From 450965698f3c9724999c38ce2aea062ce6b8d553 Mon Sep 17 00:00:00 2001 From: Maximilian Grundke Date: Wed, 7 Mar 2018 10:55:13 +0100 Subject: [PATCH 5/7] Grow/shrink buttons depending on number of buttons visible --- app/assets/stylesheets/editor.css.scss | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/editor.css.scss b/app/assets/stylesheets/editor.css.scss index 755e3409..a38157b4 100644 --- a/app/assets/stylesheets/editor.css.scss +++ b/app/assets/stylesheets/editor.css.scss @@ -42,13 +42,14 @@ button i.fa-spin { background-color: #008CBA; margin-top: 0; width: 100%; + display: flex; button { font-size: 80%; } button, .btn-group { - width: 33.33333%; + flex-grow: 1; } .btn-group { @@ -191,4 +192,4 @@ button i.fa-spin { .enforce-bottom-margin { margin-bottom: 5px !important; -} \ No newline at end of file +} From 83eba22e7bb84182d8972d5b2e18fe714adeb636 Mon Sep 17 00:00:00 2001 From: Maximilian Grundke Date: Wed, 7 Mar 2018 11:07:45 +0100 Subject: [PATCH 6/7] Add exercise description as txt file to downloaded zip --- app/controllers/submissions_controller.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/controllers/submissions_controller.rb b/app/controllers/submissions_controller.rb index b6d7052f..410c30cd 100644 --- a/app/controllers/submissions_controller.rb +++ b/app/controllers/submissions_controller.rb @@ -75,6 +75,11 @@ class SubmissionsController < ApplicationController zio.write(file.content) end + # zip exercise description + zio.put_next_entry(t('activerecord.models.exercise.one') + '.txt') + zio.write(@submission.exercise.title + "\r\n======================\r\n") + zio.write(@submission.exercise.description) + # zip .co file zio.put_next_entry(".co") zio.write(File.read id_file) From 84bd85703df222dfcaea5bd93227a793f1f2757d Mon Sep 17 00:00:00 2001 From: Ralf Teusner Date: Wed, 7 Mar 2018 17:01:57 +0100 Subject: [PATCH 7/7] add submission_ids to existing RFCs via SQL query (query included as a comment) --- ..._add_submission_to_request_for_comments.rb | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/db/migrate/20160630154310_add_submission_to_request_for_comments.rb b/db/migrate/20160630154310_add_submission_to_request_for_comments.rb index d7d13e67..a532bcf9 100644 --- a/db/migrate/20160630154310_add_submission_to_request_for_comments.rb +++ b/db/migrate/20160630154310_add_submission_to_request_for_comments.rb @@ -3,3 +3,31 @@ class AddSubmissionToRequestForComments < ActiveRecord::Migration add_reference :request_for_comments, :submission end end + +=begin +We issued the following on the database to add the submission_ids for existing entries + +UPDATE request_for_comments +SET submission_id = sub.submission_id_external +FROM +(SELECT s.id AS submission_id_external, + rfc.id AS rfc_id, + s.created_at AS submission_created_at, + rfc.created_at AS rfc_created_at +FROM submissions s, + request_for_comments rfc +WHERE s.user_id = rfc.user_id +AND s.exercise_id = rfc.exercise_id +AND rfc.created_at + interval '2 hours' > s.created_at +AND s.created_at = + (SELECT MAX(created_at) + FROM submissions + WHERE exercise_id = s.exercise_id + AND user_id = s.user_id + AND rfc.created_at + interval '2 hours' > created_at + GROUP BY s.exercise_id, + s.user_id)) as sub +WHERE id = sub.rfc_id +AND submission_id IS NULL; + +=end