<commit_before>class Admin::PeopleController < ApplicationController

  layout 'admin'
  before_filter :authenticate_admin!

  def index
    @people = Popolo::Person.all
  end

  def new
    @person = Popolo::Person.find(params[:id])
  end

  def create
    @person = Popolo::person.new(person_params)
    respond_to do |format|
      if @person.save
        format.html do
          redirect_to admin_persons_url, notice: 'Person was successfully created.'
        end
      else
        format.html { render :new }
      end
    end
  end

  def edit
    @person = Popolo::Person.find(params[:id])
  end

  def update
    @person = Popolo::person.find(params[:id])
    respond_to do |format|
      if @person.update_attributes(person_params)
        format.html do
          redirect_to admin_persons_path,  notice: 'Person was successfully updated.'
        end
      else
        format.html { render :edit }
      end
    end
  end

  def destroy
    p = Popolo::Person.find(params[:id])
    p.destroy
    respond_to do |format|
      format.html { redirect_to admin_people_path }
    end
  end

  private

  def person_params
    params[:person]
  end

end<commit_msg>fixes people controller logic and handle dates<commit_after>class Admin::PeopleController < ApplicationController

  layout 'admin'
  before_filter :authenticate_admin!

  def index
    @people = Popolo::Person.all
  end

  def new
    @person = Popolo::Person.new
  end

  def create
    @person = Popolo::Person.new(person_params)
    respond_to do |format|
      if @person.save
        format.html do
          redirect_to admin_people_path, notice: 'Person was successfully created.'
        end
      else
        format.html { render :new }
      end
    end
  end

  def edit
    @person = Popolo::Person.find(params[:id])
  end

  def update
    @person = Popolo::Person.find(params[:id])
    respond_to do |format|
      if @person.update_attributes(person_params)
        format.html do
          redirect_to admin_people_path,  notice: 'Person was successfully updated.'
        end
      else
        format.html { render :edit }
      end
    end
  end

  def destroy
    p = Popolo::Person.find(params[:id])
    p.destroy
    respond_to do |format|
      format.html { redirect_to admin_people_path }
    end
  end

  private

  def person_params
    handle_date_params(params[:person], "birth_date")
    handle_date_params(params[:person], "death_date")
  end

end
{'fraction_non_alphanumeric': 0.08475957620211899, 'fraction_numerical': 0.0, 'mean_word_length': 2.6209439528023597, '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': '2877878', 'n_tokens_mistral': 759, 'n_tokens_neox': 736, 'n_words': 194}