<commit_before>include EventsHelper
require_relative '../helpers/fetch_sheets.rb'
require 'byebug'

class CasController < ApplicationController
  include SessionsHelper
  before_action :set_ca, only: [:show, :edit, :update, :destroy]
  before_action :require_login
  before_action :require_ca_login, only: [:show, :edit, :update]
  before_action :require_admin_login, only: [:index, :new, :create, :update, :destroy]
  
  def ca_params
    params.require(:ca).permit(:name, :email, :phone_number)
  end

  # GET /cas
  # GET /cas.json
  def index
    @ca = Ca.all
  end

  # GET /cas/1
  # GET /cas/1.json
  def show
  end

  # GET /cas/new
  def new
    @ca = Ca.new
  end

  # GET /cas/1/edit
  def edit
    # if @ca.update_attributes(ca_params)
    #   flash[:success] = "Profile updated"
    #   redirect_to @ca
    # else
    #   render 'edit'
    # end
  end

  # POST /cas
  # POST /cas.json
  def create
    print "In create method"
    params.permit!
    @ca = Ca.create(ca_params)
    
    if @ca.save
      puts "In create now saving and redirecting to"
      redirect_to cas_path
    else
      redirect_to action: 'error'
    end
    
  end
  
  def error
  end

  # PATCH/PUT /cas/1
  # PATCH/PUT /cas/1.json
  def update
    params.permit!
    respond_to do |format|
      if @ca.update(ca_params)
        format.html { redirect_to @ca, notice: 'Ca was successfully updated.' }
        format.json { render :show, status: :ok, location: @ca }
      else
        format.html { render :edit }
        format.json { render json: @ca.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /cas/1<commit_msg>removed print statements and comments<commit_after>include EventsHelper
require_relative '../helpers/fetch_sheets.rb'

class CasController < ApplicationController
  include SessionsHelper
  before_action :set_ca, only: [:show, :edit, :update, :destroy]
  before_action :require_login
  before_action :require_ca_login, only: [:show, :edit, :update]
  before_action :require_admin_login, only: [:index, :new, :create, :update, :destroy]
  
  def ca_params
    params.require(:ca).permit(:name, :email, :phone_number)
  end

  # GET /cas
  # GET /cas.json
  def index
    @ca = Ca.all
  end

  # GET /cas/1
  # GET /cas/1.json
  def show
  end

  # GET /cas/new
  def new
    @ca = Ca.new
  end

  # GET /cas/1/edit
  def edit
    
  end

  # POST /cas
  # POST /cas.json
  def create
    params.permit!
    @ca = Ca.create(ca_params)
    
    if @ca.save
      redirect_to cas_path
    else
      redirect_to action: 'error'
    end
    
  end
  
  def error
  end

  # PATCH/PUT /cas/1
  # PATCH/PUT /cas/1.json
  def update
    params.permit!
    respond_to do |format|
      if @ca.update(ca_params)
        format.html { redirect_to @ca, notice: 'Ca was successfully updated.' }
        format.json { render :show, status: :ok, location: @ca }
      else
        format.html { render :edit }
        format.json { render json: @ca.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /cas/1
{'fraction_non_alphanumeric': 0.10900163666121113, 'fraction_numerical': 0.003927986906710311, 'mean_word_length': 2.5329479768786127, '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': '2248841', 'n_tokens_mistral': 1085, 'n_tokens_neox': 1067, 'n_words': 288}