<commit_before>module Leagues
  module Rosters
    module Transfers
      module CreationService
        include BaseService

        def call(roster, params)
          request = roster.transfer_requests.new(params)

          request.transaction do
            save_or_approve(request, roster) || rollback!
          end

          request
        end

        private

        def save_or_approve(request, roster)
          if roster.league.transfers_require_approval?
            request_notify_user(request, request.user, roster)

            request.save
          else
            transfer_notify_user(request, request.user, roster)

            request.approve
          end
        end

        def request_msg(request)
          if request.is_joining?
            'into'
          else
            'out of'<commit_msg>Fixed bug where users would be notified of transactions even when an error happened during creation<commit_after>module Leagues
  module Rosters
    module Transfers
      module CreationService
        include BaseService

        def call(roster, params)
          request = roster.transfer_requests.new(params)

          request.transaction do
            save_or_approve(request, roster)
          end

          request
        end

        private

        def save_or_approve(request, roster)
          if roster.league.transfers_require_approval?
            request.save || rollback!

            request_notify_user(request, request.user, roster)
          else
            request.approve || rollback!

            transfer_notify_user(request, request.user, roster)
          end
        end

        def request_msg(request)
          if request.is_joining?
            'into'
          else
            'out of'
{'fraction_non_alphanumeric': 0.05191100969766115, 'fraction_numerical': 0.0, 'mean_word_length': 1.7578616352201257, 'pattern_counts': {'":': 0, '<': 3, '<?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': '371150', 'n_tokens_mistral': 463, 'n_tokens_neox': 429, 'n_words': 111}