Guest User

Untitled

a guest
Apr 25th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.17 KB | None | 0 0
  1. sitelock_cts = Company.find(47).call_types.joins(:calls).pluck(:id).uniq
  2. weebly_cts = Company.find(7).call_types.joins(:calls).pluck(:id).uniq
  3. compounds = [
  4. # generic
  5. {
  6. name: "Hold",
  7. uid: "hold",
  8. description: "Rep puts the customer on hold",
  9. call_type_ids: sitelock_cts + weebly_cts,
  10. highlight: true,
  11. scorecard: false
  12. },
  13.  
  14. # sitelock
  15. {
  16. name: "Expresses Frustration",
  17. uid: "expresses_frustration",
  18. description: "Either the rep or the customer express frustration/anger",
  19. call_type_ids: sitelock_cts,
  20. highlight: true,
  21. scorecard: false
  22. },
  23. {
  24. name: "No Annual Pricing With Close",
  25. uid: "no_annual_pricing_close",
  26. description: "Rep does not mention annual pricing, and closes the sale",
  27. call_type_ids: sitelock_cts,
  28. highlight: true,
  29. scorecard: false
  30. },
  31. {
  32. name: "Objection Handled",
  33. uid: "objection_handled",
  34. description: "Customer has multiple objections, rep closes the sale",
  35. call_type_ids: sitelock_cts,
  36. highlight: true,
  37. scorecard: false
  38. },
  39. {
  40. name: "Expresses Appreciation",
  41. uid: "expresses_appreciation",
  42. description: "Customer expresses appreciation",
  43. call_type_ids: sitelock_cts,
  44. highlight: true,
  45. scorecard: false
  46. },
  47. {
  48. name: "Monologue",
  49. uid: "monologue",
  50. description: "Rep speaks uninterrupted at length",
  51. call_type_ids: sitelock_cts,
  52. highlight: true,
  53. scorecard: false
  54. },
  55. {
  56. name: "Churn",
  57. uid: "churn",
  58. description: "Rep says a churn causing statement",
  59. call_type_ids: sitelock_cts,
  60. highlight: true,
  61. scorecard: false
  62. },
  63. {
  64. name: "Exemplary",
  65. uid: "exemplary",
  66. description: "Rep won the deal", # TODO figure out what this means
  67. call_type_ids: sitelock_cts,
  68. highlight: true,
  69. scorecard: false
  70. },
  71. {
  72. name: "Missed Opportunity",
  73. uid: "missed_opportunity",
  74. description: "Rep missed an opportunity to further the deal",
  75. call_type_ids: sitelock_cts,
  76. highlight: true,
  77. scorecard: false
  78. },
  79. {
  80. name: "No Next Step",
  81. uid: "no_next_step",
  82. description: "Rep didn't schedule a next step",
  83. call_type_ids: sitelock_cts,
  84. highlight: true,
  85. scorecard: false
  86. },
  87.  
  88. # weebly
  89. {
  90. name: "Gave Up",
  91. uid: "gave_up",
  92. description: "Rep gave up on a call",
  93. call_type_ids: weebly_cts,
  94. highlight: true,
  95. scorecard: false
  96. },
  97.  
  98. # scorecard
  99. # {
  100. # name: "Sales Activity 4 Min",
  101. # uid: "sales_activity_4_min",
  102. # description: "Longer than 4 minutes with sales activity",
  103. # call_type_ids: sitelock_cts,
  104. # highlight: false,
  105. # scorecard: true
  106. # },
  107. # {
  108. # name: "Received 2 Objections",
  109. # uid: "received_2_objections",
  110. # description: "Received at least 2 objections",
  111. # call_type_ids: sitelock_cts,
  112. # highlight: false,
  113. # scorecard: true
  114. # },
  115. # {
  116. # name: "Sales Activity 10 Min",
  117. # uid: "sales_activity_10_min",
  118. # description: "Longer than 10 min with sales activity",
  119. # call_type_ids: sitelock_cts,
  120. # highlight: false,
  121. # scorecard: true
  122. # },
  123. # {
  124. # name: "Missed Prompting Action",
  125. # uid: "missed_prompting_action",
  126. # description: "Missed a prompting action opportunity",
  127. # call_type_ids: sitelock_cts,
  128. # highlight: false,
  129. # scorecard: true
  130. # }
  131. ]
  132.  
  133. compounds.each do |compound_obj|
  134. compound = Compound
  135. .where(name: compound_obj[:name],
  136. uid: compound_obj[:uid],
  137. description: compound_obj[:description],
  138. highlight: compound_obj[:highlight],
  139. scorecard: compound_obj[:scorecard]
  140. )
  141. .first_or_create
  142.  
  143. compound_obj[:call_type_ids].each do |ct_id|
  144. CallTypeCompound
  145. .where(call_type_id: ct_id,
  146. compound_id: compound.id)
  147. .first_or_create
  148. end
  149. end
  150.  
  151. pretag = false
  152. if pretag
  153. AutoCompound::CompoundMatchers
  154. monologue_id = Compound.find_by(uid: "monologue").id
  155. sitelock_calls = Call.where(status: 600, company_id: 47)
  156. call_compounds = AutoCompound::Monologue.set(sitelock_calls)
  157. puts call_compounds
  158.  
  159. call_compounds.each do |cc|
  160. CallCompound.create(call_id: cc[:call_id],
  161. event_ids: cc[:event_ids],
  162. compound_id: monologue_id)
  163. end
  164. end
Add Comment
Please, Sign In to add comment