Add exercise feedback page for pair programming study
This commit is contained in:

committed by
Sebastian Serth

parent
79422225a8
commit
4b90a2a3c5
@ -17,6 +17,8 @@ class Submission < ApplicationRecord
|
||||
has_many :testruns
|
||||
has_many :structured_errors, dependent: :destroy
|
||||
has_many :comments, through: :files
|
||||
has_one :user_exercise_feedback
|
||||
has_one :pair_programming_exercise_feedback
|
||||
|
||||
belongs_to :external_users, lambda {
|
||||
where(submissions: {contributor_type: 'ExternalUser'}).includes(:submissions)
|
||||
@ -118,12 +120,18 @@ class Submission < ApplicationRecord
|
||||
end
|
||||
|
||||
def redirect_to_feedback?
|
||||
return false if PairProgramming23Study.experiment_course?(study_group_id)
|
||||
|
||||
# Redirect 10% of users to the exercise feedback page. Ensure, that always the same
|
||||
# users get redirected per exercise and different users for different exercises. If
|
||||
# desired, the number of feedbacks can be limited with exercise.needs_more_feedback?(submission)
|
||||
(contributor_id + exercise.created_at.to_i) % 10 == 1
|
||||
end
|
||||
|
||||
def redirect_to_survey?
|
||||
cause == 'submit' && pair_programming_exercise_feedback.blank? && PairProgramming23Study.experiment_course?(study_group_id)
|
||||
end
|
||||
|
||||
def own_unsolved_rfc(user)
|
||||
Pundit.policy_scope(user, RequestForComment).joins(:submission).where(submission: {contributor:}).unsolved.find_by(exercise:)
|
||||
end
|
||||
|
Reference in New Issue
Block a user