<commit_before>class PaymentReminderController < ApplicationController
  before_filter :restrict_to_admin
  before_action :get_event, :get_users

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

  def get_users
    # @users = get_admin_users
    # TODO - make this a value pulled in from the user
    @user_events = UserEvent.where(event_id: @event.id)
    # pull the users out of this
    @users = []
    @user_events.each do |user|
      unless user.paid?
        @users.push user.user
      end
    end
    # sort the users
    @users = @users.sort { |a, b| a <=> b }
  end

  def new

  end

  def update
    @message = Message.new
    @message.email = current_user.email
    @message.subject = @event.name + "Payment Reminder Message"
    @message.content = "This is my content"
    @message.name = @event.name

    emails = @users.collect(&:email).join(",")

    if @message.valid?
      ContactMailer.payment_reminder(@message, emails).deliver_now
      redirect_to welcome_index_path, notice: "Your messages has been sent."
    else
      flash[:alert] = "An error occurred while delivering this message."
      render :new
    end
  end

  private
  # Use callbacks to share common setup or constraints between actions.

  def message_params
    params.require(:event)
  end
end<commit_msg>Add missing space<commit_after>class PaymentReminderController < ApplicationController
  before_filter :restrict_to_admin
  before_action :get_event, :get_users

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

  def get_users
    # @users = get_admin_users
    # TODO - make this a value pulled in from the user
    @user_events = UserEvent.where(event_id: @event.id)
    # pull the users out of this
    @users = []
    @user_events.each do |user|
      unless user.paid?
        @users.push user.user
      end
    end
    # sort the users
    @users = @users.sort { |a, b| a <=> b }
  end

  def new

  end

  def update
    @message = Message.new
    @message.email = current_user.email
    @message.subject = @event.name + " Payment Reminder Message"
    @message.content = "This is my content"
    @message.name = @event.name

    emails = @users.collect(&:email).join(",")

    if @message.valid?
      ContactMailer.payment_reminder(@message, emails).deliver_now
      redirect_to welcome_index_path, notice: "Your messages has been sent."
    else
      flash[:alert] = "An error occurred while delivering this message."
      render :new
    end
  end

  private
  # Use callbacks to share common setup or constraints between actions.

  def message_params
    params.require(:event)
  end
end
{'fraction_non_alphanumeric': 0.0925293894577171, 'fraction_numerical': 0.0, 'mean_word_length': 2.9728915662650603, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '3392103', 'n_tokens_mistral': 817, 'n_tokens_neox': 804, 'n_words': 241}