Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sitelock_cts = Company.find(47).call_types.joins(:calls).pluck(:id).uniq
- weebly_cts = Company.find(7).call_types.joins(:calls).pluck(:id).uniq
- compounds = [
- # generic
- {
- name: "Hold",
- uid: "hold",
- description: "Rep puts the customer on hold",
- call_type_ids: sitelock_cts + weebly_cts,
- highlight: true,
- scorecard: false
- },
- # sitelock
- {
- name: "Expresses Frustration",
- uid: "expresses_frustration",
- description: "Either the rep or the customer express frustration/anger",
- call_type_ids: sitelock_cts,
- highlight: true,
- scorecard: false
- },
- {
- name: "No Annual Pricing With Close",
- uid: "no_annual_pricing_close",
- description: "Rep does not mention annual pricing, and closes the sale",
- call_type_ids: sitelock_cts,
- highlight: true,
- scorecard: false
- },
- {
- name: "Objection Handled",
- uid: "objection_handled",
- description: "Customer has multiple objections, rep closes the sale",
- call_type_ids: sitelock_cts,
- highlight: true,
- scorecard: false
- },
- {
- name: "Expresses Appreciation",
- uid: "expresses_appreciation",
- description: "Customer expresses appreciation",
- call_type_ids: sitelock_cts,
- highlight: true,
- scorecard: false
- },
- {
- name: "Monologue",
- uid: "monologue",
- description: "Rep speaks uninterrupted at length",
- call_type_ids: sitelock_cts,
- highlight: true,
- scorecard: false
- },
- {
- name: "Churn",
- uid: "churn",
- description: "Rep says a churn causing statement",
- call_type_ids: sitelock_cts,
- highlight: true,
- scorecard: false
- },
- {
- name: "Exemplary",
- uid: "exemplary",
- description: "Rep won the deal", # TODO figure out what this means
- call_type_ids: sitelock_cts,
- highlight: true,
- scorecard: false
- },
- {
- name: "Missed Opportunity",
- uid: "missed_opportunity",
- description: "Rep missed an opportunity to further the deal",
- call_type_ids: sitelock_cts,
- highlight: true,
- scorecard: false
- },
- {
- name: "No Next Step",
- uid: "no_next_step",
- description: "Rep didn't schedule a next step",
- call_type_ids: sitelock_cts,
- highlight: true,
- scorecard: false
- },
- # weebly
- {
- name: "Gave Up",
- uid: "gave_up",
- description: "Rep gave up on a call",
- call_type_ids: weebly_cts,
- highlight: true,
- scorecard: false
- },
- # scorecard
- # {
- # name: "Sales Activity 4 Min",
- # uid: "sales_activity_4_min",
- # description: "Longer than 4 minutes with sales activity",
- # call_type_ids: sitelock_cts,
- # highlight: false,
- # scorecard: true
- # },
- # {
- # name: "Received 2 Objections",
- # uid: "received_2_objections",
- # description: "Received at least 2 objections",
- # call_type_ids: sitelock_cts,
- # highlight: false,
- # scorecard: true
- # },
- # {
- # name: "Sales Activity 10 Min",
- # uid: "sales_activity_10_min",
- # description: "Longer than 10 min with sales activity",
- # call_type_ids: sitelock_cts,
- # highlight: false,
- # scorecard: true
- # },
- # {
- # name: "Missed Prompting Action",
- # uid: "missed_prompting_action",
- # description: "Missed a prompting action opportunity",
- # call_type_ids: sitelock_cts,
- # highlight: false,
- # scorecard: true
- # }
- ]
- compounds.each do |compound_obj|
- compound = Compound
- .where(name: compound_obj[:name],
- uid: compound_obj[:uid],
- description: compound_obj[:description],
- highlight: compound_obj[:highlight],
- scorecard: compound_obj[:scorecard]
- )
- .first_or_create
- compound_obj[:call_type_ids].each do |ct_id|
- CallTypeCompound
- .where(call_type_id: ct_id,
- compound_id: compound.id)
- .first_or_create
- end
- end
- pretag = false
- if pretag
- AutoCompound::CompoundMatchers
- monologue_id = Compound.find_by(uid: "monologue").id
- sitelock_calls = Call.where(status: 600, company_id: 47)
- call_compounds = AutoCompound::Monologue.set(sitelock_calls)
- puts call_compounds
- call_compounds.each do |cc|
- CallCompound.create(call_id: cc[:call_id],
- event_ids: cc[:event_ids],
- compound_id: monologue_id)
- end
- end
Add Comment
Please, Sign In to add comment