<commit_before>class MatricesController < ApplicationController

  ### Resources methods ########################################################

  def index
    parse_params
    #@admin = false
    if session[:admin_id] and @admin = Admin.find(session[:admin_id])
      @pending_matrices = Matrix.where(pending: true)
      #@admin = Admin.find()
    end
    @matrices = Matrix.where(pending: false)

    apply_filters
    apply_sort
    apply_pagination
  end

  def show
    if session[:admin_id]
      @admin = Admin.find(session[:admin_id])
    end

    # Show the details page for a matrix
    id = params[:id]
    begin
      @matrix = Matrix.find(id) # Happy path
    rescue
      render :not_found         # Sad path
    end

    if !@matrix.nil? and @matrix.pending? and @admin.nil?
      render :not_found
    end
  end

  def create
    #Check the captcha
    if simple_captcha_valid?
      @matrix = Matrix.new(matrix_params)
      #Check whether the matrix has all of the necessary fields
      if @matrix.valid?

        #Process matrix here
        @matrix.pending=true
        #set num columns
        #set num rows
        #set num zeroes
        #set whether its symetric

        if @matrix.save!
          flash[:notice] = "Matrix Saved and awaiting Verification"
          redirect_to index_path
        else
          #failure
          flash[:notice] = "Failed to save matrix"
          redirect_to matrices_new_path
        end
      end
    else
      flash[:notice] = "Invalid Captcha"
      redirect_to matrices_new_path
    end
  end

  def matrix_params
    params.require(:matrix).permit(:submitter_name, :submitter_email, :submitter_confidentiality, :display_email, :name, :author, :notes, :author, :editor, :kind, :matrix_data_file_file_name)
  end
<commit_msg>The submission system will now accept submitter urls<commit_after>class MatricesController < ApplicationController

  ### Resources methods ########################################################

  def index
    parse_params
    #@admin = false
    if session[:admin_id] and @admin = Admin.find(session[:admin_id])
      @pending_matrices = Matrix.where(pending: true)
      #@admin = Admin.find()
    end
    @matrices = Matrix.where(pending: false)

    apply_filters
    apply_sort
    apply_pagination
  end

  def show
    if session[:admin_id]
      @admin = Admin.find(session[:admin_id])
    end

    # Show the details page for a matrix
    id = params[:id]
    begin
      @matrix = Matrix.find(id) # Happy path
    rescue
      render :not_found         # Sad path
    end

    if !@matrix.nil? and @matrix.pending? and @admin.nil?
      render :not_found
    end
  end

  def create
    #Check the captcha
    if simple_captcha_valid?
      @matrix = Matrix.new(matrix_params)
      #Check whether the matrix has all of the necessary fields
      if @matrix.valid?

        #Process matrix here
        @matrix.pending=true
        #set num columns
        #set num rows
        #set num zeroes
        #set whether its symetric

        if @matrix.save!
          flash[:notice] = "Matrix Saved and awaiting Verification"
          redirect_to index_path
        else
          #failure
          flash[:notice] = "Failed to save matrix"
          redirect_to matrices_new_path
        end
      end
    else
      flash[:notice] = "Invalid Captcha"
      redirect_to matrices_new_path
    end
  end

  def matrix_params
    params.require(:matrix).permit(:submitter_name, :submitter_email, :submitter_confidentiality, :submitter_url, :display_email, :name, :author, :notes, :author, :editor, :kind, :matrix_data_file_file_name)
  end

{'fraction_non_alphanumeric': 0.10973936899862825, 'fraction_numerical': 0.0, 'mean_word_length': 2.6350947158524427, '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': '7573792', 'n_tokens_mistral': 1066, 'n_tokens_neox': 1039, 'n_words': 300}