<commit_before>class TeamsController < ApplicationController
  before_action :set_team,  only: [:show, :edit, :update, :destroy]
  before_action :set_users, only: [:new, :edit]
  before_action :set_display_roles, only: :index

  load_and_authorize_resource except: [:index, :show]

  def index
    if params[:sort]
      direction = params[:direction] == 'asc' ? 'ASC' : 'DESC'
      @teams = Team.includes(:activities).order("teams.kind, activities.created_at #{direction}").references(:activities)
    else
      @teams = Team.order(:kind, :name)
    end
  end

  def show
  end

  def new
    @team = Team.new
    @team.roles.build(name: 'student', github_handle: current_user.github_handle)
    @team.sources.build(kind: 'blog')<commit_msg>Only list visible teams<commit_after>class TeamsController < ApplicationController
  before_action :set_team,  only: [:show, :edit, :update, :destroy]
  before_action :set_users, only: [:new, :edit]
  before_action :set_display_roles, only: :index

  load_and_authorize_resource except: [:index, :show]

  def index
    if params[:sort]
      direction = params[:direction] == 'asc' ? 'ASC' : 'DESC'
      @teams = Team.visible.includes(:activities).order("teams.kind, activities.created_at #{direction}").references(:activities)
    else
      @teams = Team.visible.order(:kind, :name)
    end
  end

  def show
  end

  def new
    @team = Team.new
    @team.roles.build(name: 'student', github_handle: current_user.github_handle)
    @team.sources.build(kind: 'blog')
{'fraction_non_alphanumeric': 0.13606340819022458, 'fraction_numerical': 0.0, 'mean_word_length': 4.334507042253521, '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': '505165', 'n_tokens_mistral': 510, 'n_tokens_neox': 497, 'n_words': 112}