<commit_before>class EventsController < ApplicationController
  before_action :set_event, only: [:show,
                                   :edit,
                                   :update,
                                   :destroy,
                                   :open,
                                   :open_with_mail,
                                   :close,
                                   :open_replies_mail]

  respond_to :html

  def index
    @events = Event.order('datetime DESC').page(params[:page])
  end

  def show
    @reply = Reply.find_or_initialize_by(event_id: @event.id,
                                         user_id: current_user.id)
  end

  def new
    @event = Event.new(type: params[:type])

    respond_with(@event)
  end

  def edit
  end

  def create
    @event = Event.new(event_params)
    @event.save

    respond_with(@event, location: events_path)
  end

  def update
    @event.update(event_params)

    respond_with(@event, location: events_path)
  end

  def destroy
    @event.destroy

    respond_with(@event, location: events_path)
  end

  def open
    if @event.open!
      flash[:notice] = 'Meldeliste wurde erfolgreich geöffnet.'
    else
      flash[:alert] = 'Meldeliste konnte nicht geöffnet werden.'
    end

    redirect_to :back
  end

  def open_with_mail
    if @event.open!
      EventMailer.open_replies(@event.id, message: params[:message]).deliver_later
      flash[:notice] = 'Meldeliste wurde erfolgreich geöffnet.'
<commit_msg>Redirect to event after :update, :create<commit_after>class EventsController < ApplicationController
  before_action :set_event, only: [:show,
                                   :edit,
                                   :update,
                                   :destroy,
                                   :open,
                                   :open_with_mail,
                                   :close,
                                   :open_replies_mail]

  respond_to :html

  def index
    @events = Event.order('datetime DESC').page(params[:page])
  end

  def show
    @reply = Reply.find_or_initialize_by(event_id: @event.id,
                                         user_id: current_user.id)
  end

  def new
    @event = Event.new(type: params[:type])

    respond_with(@event)
  end

  def edit
  end

  def create
    @event = Event.new(event_params)
    @event.save

    respond_with(@event)
  end

  def update
    @event.update(event_params)

    respond_with(@event)
  end

  def destroy
    @event.destroy

    respond_with(@event, location: events_path)
  end

  def open
    if @event.open!
      flash[:notice] = 'Meldeliste wurde erfolgreich geöffnet.'
    else
      flash[:alert] = 'Meldeliste konnte nicht geöffnet werden.'
    end

    redirect_to :back
  end

  def open_with_mail
    if @event.open!
      EventMailer.open_replies(@event.id, message: params[:message]).deliver_later
      flash[:notice] = 'Meldeliste wurde erfolgreich geöffnet.'

{'fraction_non_alphanumeric': 0.08548441166610794, 'fraction_numerical': 0.0, 'mean_word_length': 1.7176684881602915, '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': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5432648', 'n_tokens_mistral': 883, 'n_tokens_neox': 850, 'n_words': 191}