diff --git a/app/controllers/concerns/submission_scoring.rb b/app/controllers/concerns/submission_scoring.rb index 2b535e0d..b04f0fe2 100644 --- a/app/controllers/concerns/submission_scoring.rb +++ b/app/controllers/concerns/submission_scoring.rb @@ -94,7 +94,7 @@ module SubmissionScoring end # Return all test results except for those of a linter if not allowed - show_linter = Python20CourseWeek.show_linter? submission.exercise, submission.user_id + show_linter = Python20CourseWeek.show_linter? submission.exercise outputs&.reject do |output| next if show_linter || output.blank? diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 44db28df..f4d3c9dd 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -298,11 +298,6 @@ class ExercisesController < ApplicationController else current_user.id end - - # Tips are collected and set with set_available_tips. - # Delete tips for those users who should not see them. - # Doing this here is beneficial because all other (admin) routes still work. - @tips = nil unless Python20CourseWeek.show_tips? @exercise, current_user.id end def set_course_token diff --git a/app/controllers/request_for_comments_controller.rb b/app/controllers/request_for_comments_controller.rb index 58dee88e..face8e2e 100644 --- a/app/controllers/request_for_comments_controller.rb +++ b/app/controllers/request_for_comments_controller.rb @@ -18,7 +18,6 @@ class RequestForCommentsController < ApplicationController .with_last_activity .ransack(params[:q]) @request_for_comments = @search.result - .where("question NOT LIKE '%#loesung%'") .joins(:exercise) .where(exercises: {unpublished: false}) .includes(submission: [:study_group]) @@ -99,8 +98,6 @@ class RequestForCommentsController < ApplicationController @request_for_comment = RequestForComment.new(request_for_comment_params) - @request_for_comment.solved = true if @request_for_comment.question.include?('#loesung') - respond_to do |format| if @request_for_comment.save # create thread here and execute tests. A run is triggered from the frontend and does not need to be handled here. diff --git a/app/policies/request_for_comment_policy.rb b/app/policies/request_for_comment_policy.rb index 43d2e8de..a381ad91 100644 --- a/app/policies/request_for_comment_policy.rb +++ b/app/policies/request_for_comment_policy.rb @@ -8,7 +8,7 @@ class RequestForCommentPolicy < ApplicationPolicy end def show? - admin? || teacher_in_study_group? || author? || everyone && @record.question&.exclude?('#loesung') + everyone end def destroy? diff --git a/lib/python20_course_week.rb b/lib/python20_course_week.rb index 11afd4a1..7d510ea6 100644 --- a/lib/python20_course_week.rb +++ b/lib/python20_course_week.rb @@ -8,13 +8,7 @@ class Python20CourseWeek 1 when /Python20 Aufgabe 2/ 2 - when /Python20 Aufgabe 3.1/ - nil # Explicitly enable everything (linter + tips if available)! - when /Python20 Aufgabe 3.2/ - 3 - when /Python20 Aufgabe 3.3/ - 3 - when /Python20 Aufgabe 3.4/ + when /Python20 Aufgabe 3/ 3 when /Python20 Aufgabe 4/ 4 @@ -26,19 +20,10 @@ class Python20CourseWeek end end - def self.show_tips?(exercise, user_id) + def self.show_linter?(exercise) week = get_for(exercise) return true if week.nil? # Exercise is not part of the experiment - user_group = UserGroupSeparator.get_tips_group(user_id) - [1, 2].include?(week) && user_group == :show_tips - end - - def self.show_linter?(exercise, user_id) - week = get_for(exercise) - return true if week.nil? # Exercise is not part of the experiment - - user_group = UserGroupSeparator.get_linter_group(user_id) - [3].include?(week) && user_group == :show_linter + [3, 4].include?(week) end end diff --git a/lib/user_group_separator.rb b/lib/user_group_separator.rb deleted file mode 100644 index f1fef355..00000000 --- a/lib/user_group_separator.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -class UserGroupSeparator - - # Different user groups for Python20 course based on last digit of the user_id - # 0: show_tips && no_linter - # 1: no_tips && show_linter - # 2: show_tips && show_linter - # 3: no_tips && no_linter - - # separates user into 50% no tips, 50% with tips - def self.get_tips_group(user_id) - user_group = user_id % 4 # => 0, 1, 2, 3 - if [0, 2].include?(user_group) - :show_tips - else # [1, 3].include?(user_group) - :no_tips - end - end - - # separates user into 50% with linter, 50% without linter - def self.get_linter_group(user_id) - user_group = user_id % 4 # => 0, 1, 2, 3 - if [1, 2].include?(user_group) - :show_linter - else # [0, 3].include?(user_group) - :no_linter - end - end -end