Skip to content

Instantly share code, notes, and snippets.

@austindoeswork
Created March 15, 2018 20:48
Show Gist options
  • Save austindoeswork/084b35b135e8e4e27cfb5a9330bae3eb to your computer and use it in GitHub Desktop.
Save austindoeswork/084b35b135e8e4e27cfb5a9330bae3eb to your computer and use it in GitHub Desktop.
eids = EventSkill.where(skill_id: 110).pluck(:event_id)
events = Event.where(id: eids)
events.each_with_index do |e, i|
puts "#{i}/ #{events.length}" if i % 100 == 0
e.remove_skill(110, nil, "AustinConsole")
end
w = Company.find_by(name: "weebly")
# s1 = Skill.find_by(name: "Mentions Full Price")
# s2 = Skill.find_by(name: "Mentions Discount Price")
s1 = Skill.create(name: "Mentions Full Price",
shorthand: "mentions full price",
description: "Mentions full price of a product to the customer",
type: "AutoSkill",
customer_side_only: false,
values: [
"120", "96", "102", "14", "336",
"216", "144", "288", "18", "432",
"504", "300", "600", "35", "840",
"840", "456", "912", "46", "1104"
].sort{ |l,r| l.to_f <=> r.to_f })
s2 = Skill.create(name: "Mentions Discount Price",
shorthand: "mentions discount price",
description: "Mentions discount price of a product to the customer",
type: "AutoSkill",
customer_side_only: false,
values: [
"108", "182.4", "334.6",
"12.6", "86.4",
"194.4", "273.6", "430.2",
"16.2", "129.6", "194.4",
"453.6", "570", "836.5",
"31.5", "270", "453.6",
"756", "866.4", "1099.4",
"41.4", "410.4"
].sort{ |l,r| l.to_f <=> r.to_f })
w.call_types.each do |ct|
PermittedCallTypeSkill.create(skill_id: s1.id,
call_type_id: ct.id)
PermittedCallTypeSkill.create(skill_id: s2.id,
call_type_id: ct.id)
end
calls = Call.where(company_id: w.id).order(:created_at).reverse
calls.each_with_index do |call, i|
puts "#{i}/#{calls.length}" if i % 100 == 0
AutoScore.score_call(call)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment