<commit_before>class PeopleController < ApplicationController

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

    @tags = Tag.all
    @feed = @person.feed
    @prefix = "modified"
  end

  def update
    @person = Person.find(params[:id])
    @person.prospective = false
    @person.update(person_params)

    @person.controller_save(params["modified"])
    redirect_to edit_person_path(@person), notice: 'Person manipulated.'
  end

  def prospectives
    @people = Person.where(prospective: true).take(5)
    @all_people = Person.all
    @all_tags = Tag.all
    @overview_attributes = Person.overview_attributes
  end

  def navigate_to_person
    redirect_to edit_person_path(params[:navigate_to_person])
  end

  def prospectives_submission

    if params["previously_attached_people"].present?
      params["previously_attached_people"].each do |id, hash|
        person = Person.find(id)
        if hash["select_action"] == "block_future_email"
          ContactMethod.create(filter: "email", 
            info: person.contact_methods[0].info,
            ignore: true)
          person.destroy
        else
          hash[:person].each do |k,v|
            person.send("#{k}=",v)
          end
          person.controller_save(hash)
          if hash["select_action"] == "attach_to_existing_person"
            surviving_person = Person.find(hash["attach_to_id"][0])
            surviving_person.devour(person)
          end
        end
      end
    end

    redirect_to people_prospectives_path, notice: 'Saving attempted.'
  end

  def generate_names
    Person.generate_all_blank_names

    redirect_to root_path, notice: 'Name generation attempted.'
  end

  def table
    @people = Person.table_order
    @grey_out = [[4,1],[4,2],[4,3],[3,1],[3,2],[2,1]]
    @most_often = [[3,4]]
    @second_most_often = [[4,4]]
    @third_most_often = [[2,4],[1,4],[3,3]]
  end

  private

    def person_params
      params.require(:person).permit(Person.general_attributes)
    end

end<commit_msg>prospective to false after email save<commit_after>class PeopleController < ApplicationController

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

    @tags = Tag.all
    @feed = @person.feed
    @prefix = "modified"
  end

  def update
    @person = Person.find(params[:id])
    @person.prospective = false
    @person.update(person_params)

    @person.controller_save(params["modified"])
    redirect_to edit_person_path(@person), notice: 'Person manipulated.'
  end

  def prospectives
    @people = Person.where(prospective: true).take(5)
    @all_people = Person.all
    @all_tags = Tag.all
    @overview_attributes = Person.overview_attributes
  end

  def navigate_to_person
    redirect_to edit_person_path(params[:navigate_to_person])
  end

  def prospectives_submission

    if params["previously_attached_people"].present?
      params["previously_attached_people"].each do |id, hash|
        person = Person.find(id)
        if hash["select_action"] == "block_future_email"
          ContactMethod.create(filter: "email", 
            info: person.contact_methods[0].info,
            ignore: true)
          person.destroy
        else
          #subverting strong params in an insecure way
          person.prospective = false
          hash[:person].each do |k,v|
            person.send("#{k}=",v)
          end
          person.save
          person.controller_save(hash)
          if hash["select_action"] == "attach_to_existing_person"
            surviving_person = Person.find(hash["attach_to_id"][0])
            surviving_person.devour(person)
          end
        end
      end
    end

    redirect_to people_prospectives_path, notice: 'Saving attempted.'
  end

  def generate_names
    Person.generate_all_blank_names

    redirect_to root_path, notice: 'Name generation attempted.'
  end

  def table
    @people = Person.table_order
    @grey_out = [[4,1],[4,2],[4,3],[3,1],[3,2],[2,1]]
    @most_often = [[3,4]]
    @second_most_often = [[4,4]]
    @third_most_often = [[2,4],[1,4],[3,3]]
  end

  private

    def person_params
      params.require(:person).permit(Person.general_attributes)
    end

end
{'fraction_non_alphanumeric': 0.11534749034749035, 'fraction_numerical': 0.012065637065637066, 'mean_word_length': 2.9665071770334928, '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': '2538855', 'n_tokens_mistral': 1333, 'n_tokens_neox': 1282, 'n_words': 248}