Merge remote-tracking branch 'origin/master' into exercise-anomaly-detection
# Conflicts: # Gemfile.lock
This commit is contained in:
1
Gemfile
1
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'
|
||||
|
@ -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 (1.3.19)
|
||||
activerecord (>= 2.2)
|
||||
activerecord-jdbcpostgresql-adapter (1.3.19)
|
||||
@ -385,6 +386,7 @@ PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
activerecord-deprecated_finders
|
||||
activerecord-jdbcpostgresql-adapter
|
||||
autotest-rails
|
||||
bcrypt
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,8 @@
|
||||
}
|
||||
|
||||
.chosen-container {
|
||||
width: 250px !important;
|
||||
min-width: 250px !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.code-field {
|
||||
|
@ -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)
|
||||
@ -167,7 +172,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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user