Remove PairProgrammingExerciseFeedback

* Remove view, controller, routes & policy for PairProgrammingExerciseFeedback
* Keep model & database table
This commit is contained in:
kiragrammel
2023-10-13 12:18:28 +02:00
committed by Sebastian Serth
parent 2ce5687f53
commit 26552a0682
11 changed files with 26 additions and 228 deletions

View File

@ -593,8 +593,6 @@ class Exercise < ApplicationRecord
private :valid_submission_deadlines?
def needs_more_feedback?(submission)
return false if PairProgramming23Study.experiment_course?(submission.study_group_id)
if submission.normalized_score.to_d == BigDecimal('1.0')
user_exercise_feedbacks.final.size <= MAX_GROUP_EXERCISE_FEEDBACKS
else

View File

@ -12,6 +12,32 @@ class PairProgrammingExerciseFeedback < ApplicationRecord
scope :intermediate, -> { where.not(normalized_score: 1.00) }
scope :final, -> { where(normalized_score: 1.00) }
enum difficulty: {
too_easy: 0,
bit_too_easy: 1,
just_right: 2,
bit_too_difficult: 3,
too_difficult: 4,
}, _prefix: true
enum user_estimated_worktime: {
less_5min: 0,
between_5_and_10min: 1,
between_10_and_20min: 2,
between_20_and_30min: 3,
more_30min: 4,
}, _prefix: true
enum reason_work_alone: {
found_no_partner: 0,
too_difficult_to_find_partner: 1,
faster_alone: 2,
not_working_with_strangers: 3,
prefer_to_work_alone: 4,
accidentally_alone: 5,
other: 6,
}, _prefix: true
def to_s
'Pair Programming Exercise Feedback'
end

View File

@ -121,18 +121,12 @@ 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