<commit_before># frozen_string_literal: true

class Api::V2::TeamInvitesController < Api::V2::ApiController
  def update
    invite_id = params[:id]
    accept = params['accept']
    @invite = api_user.team_invites.open.where(id: invite_id).first
    if @invite
      if accept
        @invite.accept
        render 'api/v2/teams/accepted', status: :ok
      else
        @invite.decline
        render 'api/v2/teams/declined', status: :ok
      end
    else
      render json: { 'errors': [
        {
          title: 'Expired invite',
          detail: 'This invite does not exist or has expired'
        }
      ] }
    end
  end
end<commit_msg>Replaced where with find in team_invites_controller<commit_after># frozen_string_literal: true

class Api::V2::TeamInvitesController < Api::V2::ApiController
  def update
    invite_id = params[:id]
    accept = params['accept']
    @invite = api_user.team_invites.open.find(invite_id)
    if accept
      @invite.accept
      render 'api/v2/teams/accepted', status: :ok
    else
      @invite.decline
      render 'api/v2/teams/declined', status: :ok
    end
  rescue ActiveRecord::RecordNotFound
    render json: { 'errors': [
      {
        title: 'Expired invite',
        detail: 'This invite does not exist or has expired'
      }
    ] }
  end
end
{'fraction_non_alphanumeric': 0.10667689946277821, 'fraction_numerical': 0.0061396776669224865, 'mean_word_length': 2.6022099447513813, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '6123778', 'n_tokens_mistral': 423, 'n_tokens_neox': 426, 'n_words': 101}