review points
This commit is contained in:
@@ -13,7 +13,7 @@ class User < ApplicationRecord
|
||||
has_many :user_proxy_exercise_exercises, as: :user
|
||||
has_many :user_exercise_interventions, as: :user
|
||||
has_many :interventions, through: :user_exercise_interventions
|
||||
has_one :codeharbor_link
|
||||
has_one :codeharbor_link, dependent: :destroy
|
||||
accepts_nested_attributes_for :user_proxy_exercise_exercises
|
||||
|
||||
|
||||
|
@@ -8,11 +8,11 @@ class CodeharborLinkPolicy < ApplicationPolicy
|
||||
end
|
||||
|
||||
def new?
|
||||
teacher?
|
||||
teacher? || admin?
|
||||
end
|
||||
|
||||
def create?
|
||||
teacher?
|
||||
teacher? || admin?
|
||||
end
|
||||
|
||||
def edit?
|
||||
|
@@ -28,13 +28,9 @@ module ProformaService
|
||||
|
||||
def base_exercise
|
||||
exercise = Exercise.find_by(uuid: @task.uuid)
|
||||
if exercise
|
||||
return exercise if ExercisePolicy.new(@user, exercise).update?
|
||||
return exercise if exercise && ExercisePolicy.new(@user, exercise).update?
|
||||
|
||||
return Exercise.new(uuid: SecureRandom.uuid, unpublished: true)
|
||||
end
|
||||
|
||||
Exercise.new(uuid: @task.uuid || SecureRandom.uuid, unpublished: true)
|
||||
Exercise.new(uuid: @task.uuid, unpublished: true)
|
||||
end
|
||||
|
||||
def import_multi
|
||||
|
Reference in New Issue
Block a user