<commit_before>class Controller
  def initialize
    puts "Who are you?"
    name = gets.chomp
    user = User.find_by(name: name)
    if user.nil?
      user = User.create(name: name)
      puts "Welcome #{user.name}!"
    else
      puts "Welcome back #{user.name}!"
    end

    results = product_search

    puts "Which one best matches your wish?"

    results.each_with_index do |item, index|
      puts "#{index+1}. #{item["name"]}"
    end

    choice = gets.chomp.to_i

    choiceUPC = results[choice-1]["upc"]
    if choiceUPC.nil?
      puts "invalid upc, please try again (ie exit and start over)"
    else
      vendor_results = upc_search(choiceUPC)
    end

    puts "How much would you pay for #{results[choice-1]["name"]}?"
    print "$"

    wish_price = gets.chomp
    wish = Wish.new(price: wish_price, state: "pending")
    wish.user = user

    # puts "We found your item at the following stores:"
    # vendor_results.each do |item, index|
    #   puts "#{index+1}. #{item["store"]} at #{item["price"].to_s}"
    # end

    puts "Here's what we found for your item:"
    puts vendor_results["store"]
    puts "sells it for: $" + "%.02f" % vendor_results["price"] + "!"

    if vendor_results["price"].to_f > wish_price.to_f
      puts "That's only $" + "%.02f" % (vendor_results["price"].to_f - wish_price.to_f) + " more than your max price!"
    else
      puts "Want to purchase right now?! Give me your credit card info!"
    end

  end
end<commit_msg>Delete comment<commit_after>class Controller
  def initialize
    puts "Who are you?"
    name = gets.chomp
    user = User.find_by(name: name)
    if user.nil?
      user = User.create(name: name)
      puts "Welcome #{user.name}!"
    else
      puts "Welcome back #{user.name}!"
    end

    results = product_search

    puts "Which one best matches your wish?"

    results.each_with_index do |item, index|
      puts "#{index+1}. #{item["name"]}"
    end

    choice = gets.chomp.to_i

    choiceUPC = results[choice-1]["upc"]
    if choiceUPC.nil?
      puts "invalid upc, please try again (ie exit and start over)"
    else
      vendor_results = upc_search(choiceUPC)
    end

    puts "How much would you pay for #{results[choice-1]["name"]}?"
    print "$"

    wish_price = gets.chomp
    wish = Wish.new(price: wish_price, state: "pending")
    wish.user = user

    puts "Here's what we found for your item:"
    puts vendor_results["store"]
    puts "sells it for: $" + "%.02f" % vendor_results["price"] + "!"

    if vendor_results["price"].to_f > wish_price.to_f
      puts "That's only $" + "%.02f" % (vendor_results["price"].to_f - wish_price.to_f) + " more than your max price!"
    else
      puts "Want to purchase right now?! Give me your credit card info!"
    end

  end
end
{'fraction_non_alphanumeric': 0.1321570039611091, 'fraction_numerical': 0.005401512423478574, 'mean_word_length': 2.8211829436038514, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6194560', 'n_tokens_mistral': 942, 'n_tokens_neox': 933, 'n_words': 277}