<commit_before># frozen_string_literal: true

class SharedAssignmentRepoView < ViewModel
  include ActionView::Helpers::TextHelper
  attr_reader :assignment_repo

  delegate :github_repository, to: :assignment_repo

  def github_repo_url
    github_repository.html_url
  end

  def number_of_github_commits
    branch = github_repository.default_branch
    github_repository.commits(branch).length
  end

  def commit_text
    pluralize(number_of_github_commits, 'commit')
  end

  def github_commits_url
    branch = github_repository.default_branch
    github_repository.commits_url(branch)
  end

  def disabled_class
    assignment_repo.disabled? ? 'disabled' : ''
  end

  def github_avatar_url_for(github_user, size)
    github_user.github_avatar_url(size)<commit_msg>Show failiure text if we error when trying to get branch<commit_after># frozen_string_literal: true

class SharedAssignmentRepoView < ViewModel
  include ActionView::Helpers::TextHelper
  attr_reader :assignment_repo

  delegate :github_repository, to: :assignment_repo

  def github_repo_url
    github_repository.html_url
  end

  def number_of_github_commits
    branch = github_repository.default_branch
    github_repository.commits(branch).length
  end

  def commit_text
    pluralize(number_of_github_commits, 'commit')
  rescue GitHub::Error
    'Failed to fetch commit data'
  end

  def github_commits_url
    branch = github_repository.default_branch
    github_repository.commits_url(branch)
  rescue GitHub::Error
    ''
  end

  def disabled_class
    assignment_repo.disabled? ? 'disabled' : ''
  end

  def github_avatar_url_for(github_user, size)
    github_user.github_avatar_url(size)
{'fraction_non_alphanumeric': 0.05959475566150179, 'fraction_numerical': 0.0, 'mean_word_length': 4.932862190812721, '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': '5992313', 'n_tokens_mistral': 545, 'n_tokens_neox': 519, 'n_words': 106}