<commit_before>class EventsController < ApplicationController
  skip_before_action :require_login, only: [:index, :index_past, :show, :create, :new, :preview]

  def index
    @events = Event.approved.upcoming
    @past_events = Event.approved.past
  end

  def index_past
    @events = Event.approved.past
  end

  def show
    @event = Event.approved.find(params[:id])
  end

  def new
    @event = Event.new
  end

  def preview
    @event = Event.new(event_params)

    if @event.valid?
      render :preview
    else
      render :new
    end
  end

  def create
    @event = Event.new(event_params)

    if @event.save
      OrganizerMailer.submitted_event(@event).deliver
      redirect_to events_url, notice: "You have successfully created #{@event.name}."
    else
      render :new<commit_msg>use background job for organizer email<commit_after>class EventsController < ApplicationController
  skip_before_action :require_login, only: [:index, :index_past, :show, :create, :new, :preview]

  def index
    @events = Event.approved.upcoming
    @past_events = Event.approved.past
  end

  def index_past
    @events = Event.approved.past
  end

  def show
    @event = Event.approved.find(params[:id])
  end

  def new
    @event = Event.new
  end

  def preview
    @event = Event.new(event_params)

    if @event.valid?
      render :preview
    else
      render :new
    end
  end

  def create
    @event = Event.new(event_params)

    if @event.save
      OrganizerMailer.submitted_event(@event).deliver_later
      redirect_to events_url, notice: "You have successfully created #{@event.name}."
    else
      render :new
{'fraction_non_alphanumeric': 0.09407452657299939, 'fraction_numerical': 0.0, 'mean_word_length': 3.0544554455445545, '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': '111557', 'n_tokens_mistral': 544, 'n_tokens_neox': 507, 'n_words': 134}