<commit_before>class StoreItemController < ApplicationController
	def index

	end

	def store
		item_code = params[:item][:ItemCode]
		quantity = params[:item][:Quantity]
		if not Inventory.where(code: item_code).first
			flash[:notice] = "Invalid Item Code"
		elsif not quantity =~ /^[0-9]+$/
			flash[:notice] = "quantity must be numeric"
		end

		if not flash[:notice]
			item = Inventory.where(code: item_code).first
			orig = item.quantity
			item_name = Inventory.where(code: item_code).first.item.pluralize
			item_name = item_name.slice(0,1).capitalize + item_name.slice(1..-1)
			item.update(quantity: orig.to_i + quantity.to_i)
			flash[:notice] = "#{quantity} #{item_name} Added"
		end
		redirect_to store_item_path
	end

end<commit_msg>Salesforcified Store Item @Donald @David<commit_after>class StoreItemController < ApplicationController
    include Databasedotcom::Rails::Controller
	def index

	end

	def store
		item_code = params[:item][:ItemCode]
		quantity = params[:item][:Quantity]
		if not Item__c.find_by_Code__c(item_code)
			flash[:notice] = "Invalid Item Code"
		elsif not quantity =~ /^[0-9]+$/
			flash[:notice] = "quantity must be numeric"
		end

		if not flash[:notice]
			item = Item__c.find_by_Code__c(item_code)
			orig = item.Quantity__c.to_i
			item_name = item.Name.pluralize
			item_name = item_name.slice(0,1).capitalize + item_name.slice(1..-1)
			item.Quantity__c = (orig + quantity.to_i).to_s
			item.save
			flash[:notice] = "#{quantity} #{item_name} Added"
		end
		redirect_to store_item_path
	end

end
{'fraction_non_alphanumeric': 0.12354463130659767, 'fraction_numerical': 0.007761966364812419, 'mean_word_length': 4.428070175438597, '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': '118180', 'n_tokens_mistral': 614, 'n_tokens_neox': 531, 'n_words': 115}