Merge branch 'master' into disable_rfcs
# Conflicts: # app/assets/stylesheets/editor.css.scss
This commit is contained in:
@@ -47,7 +47,7 @@ class ExecutionEnvironment < ActiveRecord::Base
|
||||
private :validate_docker_image?
|
||||
|
||||
def working_docker_image?
|
||||
DockerClient.pull(docker_image) unless DockerClient.image_tags.include?(docker_image)
|
||||
DockerClient.pull(docker_image) unless DockerClient.find_image_by_tag(docker_image).blank?
|
||||
output = DockerClient.new(execution_environment: self).execute_arbitrary_command(VALIDATION_COMMAND)
|
||||
errors.add(:docker_image, "error: #{output[:stderr]}") if output[:stderr].present?
|
||||
rescue DockerClient::Error => error
|
||||
|
@@ -11,7 +11,13 @@ class RequestForComment < ActiveRecord::Base
|
||||
scope :not_stale, -> { where("user_id%10 <2 OR user_id%10 >= 4").where(exercise.exercise_collections.none{|ec| ec.id = 3} } ########### todo
|
||||
|
||||
def self.last_per_user(n = 5)
|
||||
from("(#{row_number_user_sql}) as request_for_comments").where("row_number <= ?", n)
|
||||
from("(#{row_number_user_sql}) as request_for_comments")
|
||||
.where("row_number <= ?", n)
|
||||
.group('request_for_comments.id, request_for_comments.user_id, request_for_comments.exercise_id,
|
||||
request_for_comments.file_id, request_for_comments.question, request_for_comments.created_at,
|
||||
request_for_comments.updated_at, request_for_comments.user_type, request_for_comments.solved,
|
||||
request_for_comments.full_score_reached, request_for_comments.submission_id, request_for_comments.row_number')
|
||||
# ugly, but necessary
|
||||
end
|
||||
|
||||
# not used right now, finds the last submission for the respective user and exercise.
|
||||
@@ -47,6 +53,14 @@ class RequestForComment < ActiveRecord::Base
|
||||
commenters.uniq {|user| user.id}
|
||||
end
|
||||
|
||||
def self.with_last_activity
|
||||
self.joins('join "submissions" s on s.id = request_for_comments.submission_id
|
||||
left outer join "files" f on f.context_id = s.id
|
||||
left outer join "comments" c on c.file_id = f.id')
|
||||
.group('request_for_comments.id')
|
||||
.select('request_for_comments.*, max(c.updated_at) as last_comment')
|
||||
end
|
||||
|
||||
def to_s
|
||||
"RFC-" + self.id.to_s
|
||||
end
|
||||
|
Reference in New Issue
Block a user