<commit_before>class UsersController < ApplicationController

  before_filter :validate_user_authorization
  
  @messages = {
    Application::PAYSTATUS_UNPAID => "Not Paid",
    Application::PAYSTATUS_PENDING => "Pending", 
    Application::PAYSTATUS_PAID => "Payment received! Thank you!",
    Application::PAYSTATUS_DECLINED => "An error occurred while processing your payment. While your application is submitted, you will need to contact support to submit payment."
  }

  def show
    @user = User.find(params[:id])
    @application = @user.get_most_recent_application
    if @application
      @completed_forms = @application.get_completed_forms
      if @application.approved
        @status = "Complete"
      elsif @application.completed
        @status = "Submitted - In Review"
      else
        @status = "Incomplete"
      end
      @year = @application.year
      @type = @application.application_type.app_type
      @forms_to_build = @application.application_type.forms
      
      @health_form_file = @application.file_attachments.find_by_file_type(:health_form)
      @advertisement_file = @application.file_attachments.find_by_file_type(:advertisement)
      
      unless @application.has_paid
        @cost_description = @application.grab_application_cost_description
        @application.calculate_current_application_cost @cost_description
        @application_cost = @application.amount_due
      end

      @application_status_msg = @messages[@application.pay_status]
    end
  end

  def submit_application
    user = User.find(params[:id])
    application = user.get_most_recent_application
    if application
      if not application.completed and application.all_forms_completed? 
        application.completed = true
        application.save
        flash[:notice] = "Application successfully submitted."
      else
        flash[:alert] = "One or more forms have yet to be submitted."<commit_msg>fixed broken test<commit_after>class UsersController < ApplicationController

  before_filter :validate_user_authorization
  
  @@messages = {
    Application::PAYSTATUS_UNPAID => "Not Paid",
    Application::PAYSTATUS_PENDING => "Pending", 
    Application::PAYSTATUS_PAID => "Payment received! Thank you!",
    Application::PAYSTATUS_DECLINED => "An error occurred while processing your payment. While your application is submitted, you will need to contact support to submit payment."
  }

  def show
    @user = User.find(params[:id])
    @application = @user.get_most_recent_application
    if @application
      @completed_forms = @application.get_completed_forms
      if @application.approved
        @status = "Complete"
      elsif @application.completed
        @status = "Submitted - In Review"
      else
        @status = "Incomplete"
      end
      @year = @application.year
      @type = @application.application_type.app_type
      @forms_to_build = @application.application_type.forms
      
      @health_form_file = @application.file_attachments.find_by_file_type(:health_form)
      @advertisement_file = @application.file_attachments.find_by_file_type(:advertisement)
      
      unless @application.has_paid
        @cost_description = @application.grab_application_cost_description
        @application.calculate_current_application_cost @cost_description
        @application_cost = @application.amount_due
      end

      @application_status_msg = @@messages[@application.pay_status]
    end
  end

  def submit_application
    user = User.find(params[:id])
    application = user.get_most_recent_application
    if application
      if not application.completed and application.all_forms_completed? 
        application.completed = true
        application.save
        flash[:notice] = "Application successfully submitted."
      else
        flash[:alert] = "One or more forms have yet to be submitted."
{'fraction_non_alphanumeric': 0.08022774327122154, 'fraction_numerical': 0.0, 'mean_word_length': 3.563164108618654, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '5267808', 'n_tokens_mistral': 1057, 'n_tokens_neox': 1018, 'n_words': 233}