<commit_before>class EventsController < ApplicationController
  before_filter :authenticate_user!, except: [:index, :show]
  before_filter :check_profile_completion, except: [:index, :show]

  respond_to :html, :json, :jsonp

  # GET /events
  # GET /events.xml
  def index
    @events = Event.active.occurs_first.limit(100)
    respond_with @events
  end

  # GET /events/1
  # GET /events/1.xml
  def show
    @event = Event.find_by_slug!(params[:id])

    # Unfortunately I can't get Rails to preload
    # users because of the crazy SQL involved.
    users_pair = User.find(@event.proposals.pluck('user_id')).map { |u| [u.id, u] }
    @users = Hash[users_pair]
    respond_with @event
  end

  # GET /events/new
  # GET /events/new.xml
  def new
    @event = Event.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @event }
    end
  end

  # GET /events/1/edit
  def edit
    @event = current_user.events.find_by_slug!(params[:id])
  end

  # POST /events
  # POST /events.xml<commit_msg>Fixes unescaped model attribute for security reasons<commit_after>class EventsController < ApplicationController
  before_filter :authenticate_user!, except: [:index, :show]
  before_filter :check_profile_completion, except: [:index, :show]

  respond_to :html, :json, :jsonp

  # GET /events
  # GET /events.xml
  def index
    @events = Event.active.occurs_first.limit(100)
    respond_with @events
  end

  # GET /events/1
  # GET /events/1.xml
  def show
    @event = Event.where(slug: params[:id]).first!

    # Unfortunately I can't get Rails to preload
    # users because of the crazy SQL involved.
    users_pair = User.find(@event.proposals.pluck('user_id')).map { |u| [u.id, u] }
    @users = Hash[users_pair]
    respond_with @event
  end

  # GET /events/new
  # GET /events/new.xml
  def new
    @event = Event.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @event }
    end
  end

  # GET /events/1/edit
  def edit
    @event = current_user.events.where(slug: params[:id]).first!
  end

  # POST /events
  # POST /events.xml
{'fraction_non_alphanumeric': 0.11990632318501171, 'fraction_numerical': 0.005620608899297424, 'mean_word_length': 3.0531309297912714, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 12}, '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': '3851368', 'n_tokens_mistral': 759, 'n_tokens_neox': 729, 'n_words': 187}