Fix reset of tasks
This commit is contained in:
@ -6,7 +6,7 @@ class ExercisesController < ApplicationController
|
||||
|
||||
before_action :handle_file_uploads, only: [:create, :update]
|
||||
before_action :set_execution_environments, only: [:create, :edit, :new, :update]
|
||||
before_action :set_exercise, only: MEMBER_ACTIONS + [:clone, :implement, :run, :statistics, :submit]
|
||||
before_action :set_exercise, only: MEMBER_ACTIONS + [:clone, :implement, :run, :statistics, :submit, :reload]
|
||||
before_action :set_file_types, only: [:create, :edit, :new, :update]
|
||||
before_action :set_teams, only: [:create, :edit, :new, :update]
|
||||
|
||||
@ -138,6 +138,10 @@ class ExercisesController < ApplicationController
|
||||
def show
|
||||
end
|
||||
|
||||
#we might want to think about auth here
|
||||
def reload
|
||||
end
|
||||
|
||||
def statistics
|
||||
end
|
||||
|
||||
|
@ -12,12 +12,12 @@ class ExercisePolicy < AdminOrAuthorPolicy
|
||||
define_method(action) { admin? || author? || team_member? }
|
||||
end
|
||||
|
||||
[:implement?, :submit?].each do |action|
|
||||
[:implement?, :submit?, :reload?].each do |action|
|
||||
define_method(action) { everyone }
|
||||
end
|
||||
|
||||
def team_member?
|
||||
@record.team.try(:members, []).include?(@user)
|
||||
@record.team.try(:members, []).include?(@user) if @record.team
|
||||
end
|
||||
private :team_member?
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
- @files.each do |file|
|
||||
= render('editor_frame', exercise: exercise, file: file)
|
||||
#editor-buttons.btn-group
|
||||
= render('editor_button', data: {:'data-message-confirm' => t('exercises.editor.confirm_start_over'), :'data-url' => exercise_path(exercise)}, icon: 'fa fa-history', id: 'start-over', label: t('exercises.editor.start_over'))
|
||||
= render('editor_button', data: {:'data-message-confirm' => t('exercises.editor.confirm_start_over'), :'data-url' => reload_exercise_path(exercise)}, icon: 'fa fa-history', id: 'start-over', label: t('exercises.editor.start_over'))
|
||||
= render('editor_button', data: {:'data-message-success' => t('submissions.create.success'), :'data-placement' => 'top', :'data-tooltip' => true}, icon: 'fa fa-save', id: 'save', label: t('exercises.editor.save'), title: t('.tooltips.save'))
|
||||
.btn-group
|
||||
= render('editor_button', disabled: true, icon: 'fa fa-ban', id: 'dummy', label: t('exercises.editor.dummy'))
|
||||
|
@ -30,5 +30,12 @@ module CodeOcean
|
||||
|
||||
config.autoload_paths << Rails.root.join('lib')
|
||||
config.eager_load_paths << Rails.root.join('lib')
|
||||
case (RUBY_ENGINE)
|
||||
when 'ruby'
|
||||
# ...
|
||||
when 'jruby'
|
||||
# plattform specific
|
||||
java.lang.Class.for_name('javax.crypto.JceSecurity').get_declared_field('isRestricted').tap{|f| f.accessible = true; f.set nil, false}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -40,6 +40,7 @@ Rails.application.routes.draw do
|
||||
post :clone
|
||||
get :implement
|
||||
get :statistics
|
||||
get :reload
|
||||
post :submit
|
||||
end
|
||||
end
|
||||
|
@ -202,23 +202,20 @@ describe ExercisesController do
|
||||
describe 'GET #show' do
|
||||
context 'as admin' do
|
||||
before(:each) { get :show, id: exercise.id }
|
||||
|
||||
expect_assigns(exercise: :exercise)
|
||||
expect_status(200)
|
||||
expect_template(:show)
|
||||
end
|
||||
context 'as internal user' do
|
||||
let(:user) { FactoryGirl.create(:internal_user) }
|
||||
before(:each) { get :show, id: exercise.id }
|
||||
expect_assigns(exercise: :exercise)
|
||||
expect_status(200)
|
||||
expect_template(:show)
|
||||
end
|
||||
context 'as external user' do
|
||||
let(:user) { FactoryGirl.create(:external_user) }
|
||||
before(:each) { get :show, id: exercise.id }
|
||||
|
||||
describe 'GET #reload' do
|
||||
context 'as anyone' do
|
||||
before(:each) { get :reload, format: :json, id: exercise.id }
|
||||
|
||||
expect_assigns(exercise: :exercise)
|
||||
expect_status(200)
|
||||
expect_template(:show)
|
||||
expect_template(:reload)
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user