<commit_before>module ScoresHelper
  def score_color(scorable)
    case scorable.scores.count
    when 0
      'bs-callout bs-callout-danger'
    when 1 
      'bs-callout bs-callout-warning'
    when 2 
      'bs-callout bs-callout-warning'
    else
      'bs-callout bs-callout-success'
    end
  end

  def team_color(team)
    # TODO: optimize this using mongoDB aggregation query to get the number
    # of commits that have less than 3 scores.
    # Kept a case statement incase we need more color codes later on
    case team.commits.includes(:scores).select { |c| c.scores.count < 3 }.count
    when 0
      'bs-callout bs-callout-success'
    else
      'bs-callout bs-callout-warning'
    end
  end
end<commit_msg>refs #3 In case of no commits check for activity<commit_after>module ScoresHelper
  def score_color(scorable)
    case scorable.scores.count
    when 0
      'bs-callout bs-callout-danger'
    when 1 
      'bs-callout bs-callout-warning'
    when 2 
      'bs-callout bs-callout-warning'
    else
      'bs-callout bs-callout-success'
    end
  end

  def team_color(team)
    # TODO: optimize this using mongoDB aggregation query to get the number
    # of commits that have less than 3 scores.
    # Kept a case statement incase we need more color codes later on
    counter = team.commits.for_round(team.round.id).includes(:scores).select { |c| c.scores.count < 3 }.count
    if counter == 0
      counter = team.activities.for_round(team.round.id).includes(:scores).select { |c| c.scores.count < 3 }.count
    end
    case counter
    when 0
      'bs-callout bs-callout-success'
    else
      'bs-callout bs-callout-warning'
    end
  end
end
{'fraction_non_alphanumeric': 0.08667065152420801, 'fraction_numerical': 0.008965929468021518, 'mean_word_length': 2.631236442516269, 'pattern_counts': {'":': 0, '<': 6, '<?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': '6172981', 'n_tokens_mistral': 591, 'n_tokens_neox': 538, 'n_words': 164}