diff --git a/app/controllers/concerns/redirect_behavior.rb b/app/controllers/concerns/redirect_behavior.rb
index 50a6131a..15db82bc 100644
--- a/app/controllers/concerns/redirect_behavior.rb
+++ b/app/controllers/concerns/redirect_behavior.rb
@@ -6,12 +6,6 @@ module RedirectBehavior
def redirect_after_submit
Rails.logger.debug { "Redirecting user with score:s #{@submission.normalized_score}" }
- # TEMPORARY: For the pythonjunior2023 course, we want to have a lot of feedback!
- if @submission.redirect_to_survey?
- redirect_to_pair_programming_survey
- return
- end
-
if @submission.normalized_score.to_d == BigDecimal('1.0')
if redirect_to_community_solution?
redirect_to_community_solution
@@ -105,16 +99,6 @@ module RedirectBehavior
@community_solution_lock.user == current_user
end
- # TEMPORARY: For the pythonjunior2023 course, we introduced a pair programming survey
- def redirect_to_pair_programming_survey
- url = new_pair_programming_exercise_feedback_path(pair_programming_exercise_feedback: {exercise_id: @exercise.id, submission_id: @submission.id})
-
- respond_to do |format|
- format.html { redirect_to(url) }
- format.json { render(json: {redirect: url}) }
- end
- end
-
def redirect_to_user_feedback
uef = UserExerciseFeedback.find_by(exercise: @exercise, user: current_user)
url = if uef
diff --git a/app/controllers/pair_programming_exercise_feedbacks_controller.rb b/app/controllers/pair_programming_exercise_feedbacks_controller.rb
deleted file mode 100644
index 8969ed69..00000000
--- a/app/controllers/pair_programming_exercise_feedbacks_controller.rb
+++ /dev/null
@@ -1,107 +0,0 @@
-# frozen_string_literal: true
-
-class PairProgrammingExerciseFeedbacksController < ApplicationController
- include CommonBehavior
- include RedirectBehavior
-
- before_action :set_presets, only: %i[new create]
-
- def comment_presets
- [[0, t('pair_programming_exercise_feedback.difficulty_easy')],
- [1, t('pair_programming_exercise_feedback.difficulty_some_what_easy')],
- [2, t('pair_programming_exercise_feedback.difficulty_ok')],
- [3, t('pair_programming_exercise_feedback.difficulty_some_what_difficult')],
- [4, t('pair_programming_exercise_feedback.difficult_too_difficult')]]
- end
-
- def time_presets
- [[0, t('pair_programming_exercise_feedback.estimated_time_less_5')],
- [1, t('pair_programming_exercise_feedback.estimated_time_5_to_10')],
- [2, t('pair_programming_exercise_feedback.estimated_time_10_to_20')],
- [3, t('pair_programming_exercise_feedback.estimated_time_20_to_30')],
- [4, t('pair_programming_exercise_feedback.estimated_time_more_30')]]
- end
-
- def reasons_presets
- [[0, t('pair_programming_exercise_feedback.reason_no_partner')],
- [1, t('pair_programming_exercise_feedback.reason_to_difficult_to_find_partner')],
- [2, t('pair_programming_exercise_feedback.reason_faster_alone')],
- [3, t('pair_programming_exercise_feedback.reason_not_working_with_strangers')],
- [4, t('pair_programming_exercise_feedback.reason_want_to_work_alone')],
- [5, t('pair_programming_exercise_feedback.reason_accidentally_alone')],
- [6, t('pair_programming_exercise_feedback.reason_other')]]
- end
-
- def new
- exercise_id = if params[:pair_programming_exercise_feedback].nil?
- params[:exercise_id]
- else
- params[:pair_programming_exercise_feedback][:exercise_id]
- end
- @exercise = Exercise.find(exercise_id)
-
- @submission = Submission.find(params[:pair_programming_exercise_feedback][:submission_id])
- authorize(@submission, :show?)
-
- @uef = PairProgrammingExerciseFeedback.new(user: current_user, exercise: @exercise, programming_group:, submission: @submission)
- authorize!
- end
-
- def create
- Sentry.set_extras(params: uef_params)
-
- @exercise = Exercise.find(uef_params[:exercise_id])
-
- if @exercise
- @uef = PairProgrammingExerciseFeedback.new(exercise: @exercise, programming_group:, study_group_id: current_user.current_study_group_id)
- @uef.update(uef_params)
- authorize!
- if validate_inputs(uef_params) && @uef.save
- redirect_after_submit
- else
- flash.now[:danger] = t('shared.message_failure')
- redirect_back fallback_location: pair_programming_exercise_feedback_path(@uef)
- end
- end
- end
-
- private
-
- def authorize!
- authorize(@uef || @uefs)
- end
-
- def set_presets
- @texts = comment_presets.to_a
- @times = time_presets.to_a
- @reasons = reasons_presets.to_a
- end
-
- def uef_params
- return if params[:pair_programming_exercise_feedback].blank?
-
- @submission = Submission.find(params[:pair_programming_exercise_feedback][:submission_id])
-
- authorize(@submission, :show?)
-
- params[:pair_programming_exercise_feedback]
- .permit(:difficulty, :user_estimated_worktime, :exercise_id, :reason_work_alone)
- .merge(user: current_user,
- submission: @submission,
- normalized_score: @submission&.normalized_score)
- end
-
- def validate_inputs(uef_params)
- if uef_params[:difficulty].to_i.negative? || uef_params[:difficulty].to_i >= comment_presets.size
- false
- else
- !(uef_params[:user_estimated_worktime].to_i.negative? || uef_params[:user_estimated_worktime].to_i >= time_presets.size)
- end
- rescue StandardError
- false
- end
-
- def programming_group
- current_contributor if current_contributor.programming_group?
- end
-end
diff --git a/app/models/exercise.rb b/app/models/exercise.rb
index 5f0c5bf5..d9dd27a7 100644
--- a/app/models/exercise.rb
+++ b/app/models/exercise.rb
@@ -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
diff --git a/app/models/pair_programming_exercise_feedback.rb b/app/models/pair_programming_exercise_feedback.rb
index f1d4ac36..c16862de 100644
--- a/app/models/pair_programming_exercise_feedback.rb
+++ b/app/models/pair_programming_exercise_feedback.rb
@@ -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
diff --git a/app/models/submission.rb b/app/models/submission.rb
index 7220bff3..cac3b566 100644
--- a/app/models/submission.rb
+++ b/app/models/submission.rb
@@ -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
diff --git a/app/policies/pair_programming_exercise_feedback_policy.rb b/app/policies/pair_programming_exercise_feedback_policy.rb
deleted file mode 100644
index cf58c9f0..00000000
--- a/app/policies/pair_programming_exercise_feedback_policy.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class PairProgrammingExerciseFeedbackPolicy < AdminOnlyPolicy
- def create?
- everyone
- end
-
- def new?
- everyone
- end
-end
diff --git a/app/views/pair_programming_exercise_feedbacks/_form.html.slim b/app/views/pair_programming_exercise_feedbacks/_form.html.slim
deleted file mode 100644
index da6373f3..00000000
--- a/app/views/pair_programming_exercise_feedbacks/_form.html.slim
+++ /dev/null
@@ -1,31 +0,0 @@
-= form_for(@uef) do |f|
- div
- h1 id="exercise-headline"
- = t('activerecord.models.user_exercise_feedback.one') + " " + @exercise.title
- = render('shared/form_errors', object: @uef)
- p
- == t('pair_programming_exercise_feedback.description')
- .mb-3
- h5.mt-4 = t('pair_programming_exercise_feedback.difficulty')
- = f.collection_radio_buttons :difficulty, @texts, :first, :last do |b|
- .form-check
- label.form-check-label
- = b.radio_button(class: 'form-check-input')
- = b.text
- h5.mt-4 = t('pair_programming_exercise_feedback.working_time')
- = f.collection_radio_buttons :user_estimated_worktime, @times, :first, :last do |b|
- .form-check
- label.form-check-label
- = b.radio_button(class: 'form-check-input')
- = b.text
- - if PairProgramming23Study.participate?(current_user, @exercise) && !current_contributor.programming_group?
- h5.mt-4 = t('pair_programming_exercise_feedback.reason_work_alone')
- = f.collection_radio_buttons :reason_work_alone, @reasons, :first, :last do |b|
- .form-check
- label.form-check-label
- = b.radio_button(class: 'form-check-input')
- == b.text
-
- = f.hidden_field(:exercise_id, :value => @exercise.id)
- = f.hidden_field(:submission_id, :value => @submission.id)
- .actions = render('shared/submit_button', f: f, object: @uef)
diff --git a/app/views/pair_programming_exercise_feedbacks/new.html.slim b/app/views/pair_programming_exercise_feedbacks/new.html.slim
deleted file mode 100644
index 7e5cfff1..00000000
--- a/app/views/pair_programming_exercise_feedbacks/new.html.slim
+++ /dev/null
@@ -1 +0,0 @@
-= render('form')
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 6897e159..4c370209 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -230,9 +230,6 @@ de:
internal_user:
one: Interner Nutzer
other: Interne Nutzer
- pair_programming_exercise_feedback:
- one: Feedback
- other: Feedbacks
programming_group:
one: Programmierpaar
other: Programmierpaare
@@ -990,29 +987,6 @@ de:
previous_label: '← Vorherige Seite'
file_template:
no_template_label: "Leere Datei"
- pair_programming_exercise_feedback:
- difficulty_easy: "Die Aufgabe war viel zu einfach."
- difficulty_some_what_easy: "Die Aufgabe war etwas zu einfach."
- difficulty_ok: "Die Aufgabenschwierigkeit war genau richtig."
- difficulty_some_what_difficult: "Die Aufgabe war etwas zu schwierig."
- difficult_too_difficult: "Die Aufgabe war viel zu schwierig."
- difficulty: "Schwierigkeit der Aufgabe:"
- description: "Vielen Dank für Deine Abgabe! Bevor du die Aufgabe beendest, würden wir uns freuen, wenn Du uns hier Feedback zur Aufgabe gibst."
- estimated_time_less_5: "weniger als 5 Minuten"
- estimated_time_5_to_10: "zwischen 5 und 10 Minuten"
- estimated_time_10_to_20: "zwischen 10 und 20 Minuten"
- estimated_time_20_to_30: "zwischen 20 und 30 Minuten"
- estimated_time_more_30: "mehr als 30 Minuten"
- working_time: "Geschätze Bearbeitungszeit für diese Aufgabe:"
- reason_no_partner: Ich habe keine:n Team-Partner:in gefunden.
- reason_to_difficult_to_find_partner: Es war zu schwierig/aufwändig, eine:n Team Partner:in zu finden.
- reason_faster_alone: Es ging schneller alleine zu arbeiten.
- reason_not_working_with_strangers: Ich möchte nicht mit fremden Personen zusammenarbeiten.
- reason_want_to_work_alone: Ich arbeite lieber alleine.
- reason_accidentally_alone: Ich habe versehentlich alleine an dieser Aufgabe gearbeitet.
- reason_other: Sonstiges
- reason_work_alone: Warum hast Du Dich dafür entschieden die Aufgabe alleine zu lösen?
- no_feedback: "Es wurde noch kein Feedback zu dieser Aufgabe gegeben."
user_exercise_feedback:
difficulty_easy: "Die Aufgabe war zu einfach"
difficulty_some_what_easy: "Die Aufgabe war etwas zu einfach"
diff --git a/config/locales/en.yml b/config/locales/en.yml
index a12e0186..49cbd11a 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -230,9 +230,6 @@ en:
internal_user:
one: Internal User
other: Internal Users
- pair_programming_exercise_feedback:
- one: Feedback
- other: Feedbacks
programming_group:
one: Programming Pair
other: Programming Pairs
@@ -990,29 +987,6 @@ en:
previous_label: '← Previous Page'
file_template:
no_template_label: "Empty File"
- pair_programming_exercise_feedback:
- difficulty_easy: "The exercise was far too easy."
- difficulty_some_what_easy: "The exercise was a bit too easy."
- difficulty_ok: "The exercise difficulty was just right."
- difficulty_some_what_difficult: "The exercise was a bit too difficult."
- difficult_too_difficult: "The exercise was far too difficult."
- difficulty: "Difficulty of the exercise:"
- description: "Thank you for your submission! Before you finish the task, we kindly ask you for feedback for this exercise."
- estimated_time_less_5: "less than 5 minutes"
- estimated_time_5_to_10: "between 5 and 10 minutes"
- estimated_time_10_to_20: "between 10 and 20 minutes"
- estimated_time_20_to_30: "between 20 and 30 minutes"
- estimated_time_more_30: "more than 30 minutes"
- working_time: "Estimated time working on this exercise:"
- reason_no_partner: I have not found a team partner.
- reason_to_difficult_to_find_partner: It was too difficult to find a team partner.
- reason_faster_alone: It was faster to work alone.
- reason_not_working_with_strangers: I do not want to work with strangers.
- reason_want_to_work_alone: I prefer to work alone.
- reason_accidentally_alone: I accidentally worked alone on this exercise.
- reason_other: Other
- reason_work_alone: Why did you decide to solve this exercise alone?
- no_feedback: "There is no feedback for this exercise yet."
user_exercise_feedback:
difficulty_easy: "the exercise was too easy"
difficulty_some_what_easy: "the exercise was somewhat easy"
diff --git a/config/routes.rb b/config/routes.rb
index b1a340a4..384c60d7 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -119,8 +119,6 @@ Rails.application.routes.draw do
resources :user_exercise_feedbacks, except: %i[show index]
- resources :pair_programming_exercise_feedbacks, only: %i[new create]
-
resources :external_users, only: %i[index show], concerns: :statistics do
resources :exercises do
get :statistics, to: 'exercises#external_user_statistics', on: :member