<commit_before>class HintRequestsController < ApplicationController
	before_action :logged_in_user, only: :create
	before_action :belong_to_team, only: :create
	before_action :competition_active, only: :create

	def create
		points = 0
		@problem = Problem.find(params[:problem_id])
		@bracket = Bracket.find(current_team.bracket_id)
		@user = current_user

		@team = Team.find(@user.team_id)
		hints_requested = @team.get_hints_requested(@problem.id)

		if @problem.solved_by?(@team.id)
			flash[:warning] = "Your team has already solved this challenge!"
			redirect_to @problem
		elsif ((!hints_requested || 
				 hints_requested.count < @problem.number_of_hints_available) &&
				 @problem.number_of_hints_available > 0 &&
				 (use_handicap? && hints_requested.count >= @bracket.hints_available))

			@hint = Hint.find(@problem.get_next_hint(@team.id, @problem.id))<commit_msg>fixing reverse logic in checking available hints<commit_after>class HintRequestsController < ApplicationController
	before_action :logged_in_user, only: :create
	before_action :belong_to_team, only: :create
	before_action :competition_active, only: :create

	def create
		points = 0
		@problem = Problem.find(params[:problem_id])
		@bracket = Bracket.find(current_team.bracket_id)
		@user = current_user

		@team = Team.find(@user.team_id)
		hints_requested = @team.get_hints_requested(@problem.id)

		if @problem.solved_by?(@team.id)
			flash[:warning] = "Your team has already solved this challenge!"
			redirect_to @problem
		elsif ((!hints_requested || 
				 hints_requested.count < @problem.number_of_hints_available) &&
				 @problem.number_of_hints_available > 0 &&
				 (use_handicap? && hints_requested.count < @bracket.hints_available))

			@hint = Hint.find(@problem.get_next_hint(@team.id, @problem.id))
{'fraction_non_alphanumeric': 0.11525612472160357, 'fraction_numerical': 0.0022271714922048997, 'mean_word_length': 5.487364620938628, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5206101', 'n_tokens_mistral': 685, 'n_tokens_neox': 593, 'n_words': 111}