<commit_before>class SessionsController < ApplicationController
  include ApplicationHelper
  before_action :get_event
  before_action :set_session, only: [:show, :edit, :update, :destroy]

  def get_event
    @event = Event.find(params[:event_id])
  end


  # GET /sessions
  # GET /sessions.json
  def index
    prevent_non_admin
    @sessions = Session.where(event_id: @event.id)

  end

  # GET /sessions/1
  # GET /sessions/1.json
  def show
    get_session_data(@session)
  end

  def get_session_data (session)
    @registration_tables = {}
    @gm_sessions         = init_gm_sessions
    @player_sessions     = init_player_sessions
    @rsvps               = @event.user_events


    @rsvps.each do |rsvp|
      player_tables = rsvp.registration_tables
      player_tables.each do |reg_table|
        if reg_table.table.session == session
          players = @player_sessions[reg_table.table]
          if players.nil?
            players                           = []
            @player_sessions[reg_table.table] = players<commit_msg>Make session index available to hosts<commit_after>class SessionsController < ApplicationController
  include ApplicationHelper
  before_action :get_event
  before_action :set_session, only: [:show, :edit, :update, :destroy]

  def get_event
    @event = Event.find(params[:event_id])
  end


  # GET /sessions
  # GET /sessions.json
  def index
    return unless restrict_to_hosts
    @sessions = Session.where(event_id: @event.id)
  end

  # GET /sessions/1
  # GET /sessions/1.json
  def show
    get_session_data(@session)
  end

  def get_session_data (session)
    @registration_tables = {}
    @gm_sessions         = init_gm_sessions
    @player_sessions     = init_player_sessions
    @rsvps               = @event.user_events


    @rsvps.each do |rsvp|
      player_tables = rsvp.registration_tables
      player_tables.each do |reg_table|
        if reg_table.table.session == session
          players = @player_sessions[reg_table.table]
          if players.nil?
            players                           = []
            @player_sessions[reg_table.table] = players
{'fraction_non_alphanumeric': 0.0846262341325811, 'fraction_numerical': 0.0018805829807240243, 'mean_word_length': 2.6129032258064515, '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': '5613609', 'n_tokens_mistral': 680, 'n_tokens_neox': 657, 'n_words': 138}