fixed multiple style guide violations
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
module CommonBehavior
|
||||
def create_and_respond(options = {}, &block)
|
||||
def create_and_respond(options = {})
|
||||
@object = options[:object]
|
||||
respond_to do |format|
|
||||
if @object.save
|
||||
|
@ -2,8 +2,8 @@ module SubmissionParameters
|
||||
include FileParameters
|
||||
|
||||
def reject_illegal_file_attributes!(submission_params)
|
||||
if exercise = Exercise.find_by(id: submission_params[:exercise_id])
|
||||
submission_params[:files_attributes].try(:reject!) do |index, file_attributes|
|
||||
if Exercise.exists?(id: submission_params[:exercise_id])
|
||||
submission_params[:files_attributes].try(:reject!) do |_, file_attributes|
|
||||
file = CodeOcean::File.find_by(id: file_attributes[:file_id])
|
||||
file.nil? || file.hidden || file.read_only
|
||||
end
|
||||
|
@ -24,7 +24,7 @@ class ExecutionEnvironmentsController < ApplicationController
|
||||
end
|
||||
|
||||
def execute_command
|
||||
@docker_client = DockerClient.new(execution_environment: @execution_environment, user: current_user)
|
||||
@docker_client = DockerClient.new(execution_environment: @execution_environment)
|
||||
render(json: @docker_client.execute_arbitrary_command(params[:command]))
|
||||
end
|
||||
|
||||
|
@ -9,7 +9,7 @@ class SessionsController < ApplicationController
|
||||
skip_before_action :verify_authenticity_token, only: :create_through_lti
|
||||
|
||||
def create
|
||||
if user = login(params[:email], params[:password], params[:remember_me])
|
||||
if login(params[:email], params[:password], params[:remember_me])
|
||||
redirect_back_or_to(:root, notice: t('.success'))
|
||||
else
|
||||
flash.now[:danger] = t('.failure')
|
||||
|
@ -72,7 +72,7 @@ class SubmissionsController < ApplicationController
|
||||
end
|
||||
|
||||
def set_docker_client
|
||||
@docker_client = DockerClient.new(execution_environment: @submission.execution_environment, user: current_user)
|
||||
@docker_client = DockerClient.new(execution_environment: @submission.execution_environment)
|
||||
end
|
||||
private :set_docker_client
|
||||
|
||||
|
@ -42,7 +42,7 @@ module ApplicationHelper
|
||||
Kramdown::Document.new(markdown).to_html.html_safe
|
||||
end
|
||||
|
||||
def row(options={}, &block)
|
||||
def row(options = {}, &block)
|
||||
content_tag(:div, class: 'attribute-row row') do
|
||||
label_column(options[:label]) + value_column(options[:value], &block)
|
||||
end
|
||||
@ -65,7 +65,7 @@ module ApplicationHelper
|
||||
end
|
||||
private :translation_present?
|
||||
|
||||
def value_column(value, &block)
|
||||
def value_column(value)
|
||||
content_tag(:div, class: 'col-sm-9') do
|
||||
block_given? ? yield : symbol_for(value)
|
||||
end
|
||||
|
@ -4,7 +4,7 @@ class UserMailer < ActionMailer::Base
|
||||
mail(subject: t('mailers.user_mailer.activation_needed.subject'), to: user.email)
|
||||
end
|
||||
|
||||
def activation_success_email(user)
|
||||
def activation_success_email(*)
|
||||
end
|
||||
|
||||
def reset_password_email(user)
|
||||
|
@ -13,7 +13,7 @@ module User
|
||||
end
|
||||
|
||||
ROLES.each do |role|
|
||||
define_method("#{role}?") { self.try(:role) == role }
|
||||
define_method("#{role}?") { try(:role) == role }
|
||||
end
|
||||
|
||||
def external?
|
||||
|
@ -7,6 +7,8 @@ class Submission < ActiveRecord::Base
|
||||
|
||||
belongs_to :exercise
|
||||
|
||||
delegate :execution_environment, to: :exercise
|
||||
|
||||
scope :final, -> { where(cause: 'submit') }
|
||||
scope :intermediate, -> { where.not(cause: 'submit') }
|
||||
|
||||
@ -24,10 +26,6 @@ class Submission < ActiveRecord::Base
|
||||
ancestors.merge(descendants).values
|
||||
end
|
||||
|
||||
def execution_environment
|
||||
exercise.execution_environment
|
||||
end
|
||||
|
||||
[:download, :render, :run, :test].each do |action|
|
||||
filename = FILENAME_URL_PLACEHOLDER.gsub(/\W/, '')
|
||||
define_method("#{action}_url") do
|
||||
|
Reference in New Issue
Block a user