Fix Rubocop offenses

This commit is contained in:
Sebastian Serth
2023-12-12 10:40:45 +01:00
parent 33c282b7dd
commit 5b654debbe
2 changed files with 2 additions and 2 deletions

View File

@ -185,7 +185,7 @@ class ExercisesController < ApplicationController
def user_from_api_key def user_from_api_key
authorization_header = request.headers['Authorization'] authorization_header = request.headers['Authorization']
api_key = authorization_header&.split(' ')&.second api_key = authorization_header&.split&.second
user_by_codeharbor_token(api_key) user_by_codeharbor_token(api_key)
end end

View File

@ -151,7 +151,7 @@ class ProxyExercise < ApplicationRecord
Rails.logger.debug { "select most appropiate exercise for user. his highest difficulty was #{highest_difficulty_user_has_accessed}" } Rails.logger.debug { "select most appropiate exercise for user. his highest difficulty was #{highest_difficulty_user_has_accessed}" }
sorted_exercises = relative_knowledge_improvement.sort_by {|_k, v| v }.reverse sorted_exercises = relative_knowledge_improvement.sort_by {|_k, v| v }.reverse
sorted_exercises.each do |ex, _diff| sorted_exercises.each do |ex, _diff| # rubocop:disable Style/HashEachMethods
Rails.logger.debug { "review exercise #{ex.id} diff: #{ex.expected_difficulty}" } Rails.logger.debug { "review exercise #{ex.id} diff: #{ex.expected_difficulty}" }
if (ex.expected_difficulty - highest_difficulty_user_has_accessed) <= 1 if (ex.expected_difficulty - highest_difficulty_user_has_accessed) <= 1
Rails.logger.debug { "matched exercise #{ex.id}" } Rails.logger.debug { "matched exercise #{ex.id}" }