<commit_before>module CheckAssignments
  class AssignPerson
    attr_reader :check, :assignments_repo, :users_repo

    def initialize(project_check:, assignments_repo:, users_repo:)
      @check = project_check
      @assignments_repo = assignments_repo ||
                          CheckAssignmentsRepository.new
      @users_repo = users_repo ||
                    UsersRepository.new
    end

    def call(last_checker)
      person = pick_person(last_checker)
      create_with_assigned_user(person)
      notify_channel(compose_notice(person))
    end

    private

    def pick_person(last_checker)
      CheckAssignments::PickPerson.new(
        latest_checker: last_checker,
        users_repository: users_repo,
      ).call
    end

    def create_with_assigned_user(person)
      CheckAssignments::Create.new(
        checker: person,
        project_check: check,
        assignments_repository: assignments_repo,
      ).call
    end

    def compose_notice(person)
      user = person.name
      reminder = check.reminder.name
      project = check.project.name

      "#{user} was just assigned to do next #{reminder} in #{project}. "
    end

    def notify_channel(message)
      CheckAssignments::Notify.new.call(
        check.project.channel_name,
        message,
      )
    end
  end
end<commit_msg>adjust spec<commit_after>module CheckAssignments
  class AssignPerson
    attr_reader :check, :assignments_repo, :users_repo

    def initialize(project_check:, assignments_repo:, users_repo:)
      @check = project_check
      @assignments_repo = assignments_repo ||
                          CheckAssignmentsRepository.new
      @users_repo = users_repo ||
                    UsersRepository.new
    end

    def call(last_checker)
      person = pick_person(last_checker)
      create_with_assigned_user(person)
      notify_channel(compose_notice(person))
    end

    private

    def pick_person(last_checker)
      CheckAssignments::PickPerson.new(
        latest_checker: last_checker,
        users_repository: users_repo,
      ).call
    end

    def create_with_assigned_user(person)
      CheckAssignments::Create.new(
        checker: person,
        project_check: check,
        assignments_repository: assignments_repo,
      ).call
    end

    def compose_notice(person)
      user = person.name
      reminder = check.reminder.name
      project = check.project.name

      "#{user} got assigned to do next #{reminder} in #{project}. "
    end

    def notify_channel(message)
      CheckAssignments::Notify.new.call(
        check.project.channel_name,
        message,
      )
    end
  end
end
{'fraction_non_alphanumeric': 0.07421431276031806, 'fraction_numerical': 0.0, 'mean_word_length': 2.5848032564450474, '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': '3863454', 'n_tokens_mistral': 769, 'n_tokens_neox': 756, 'n_words': 151}