Guest User

Untitled

a guest
Apr 8th, 2018
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.10 KB | None | 0 0
  1. puts "FIXES"
  2. Call.where(call_type_id: 130).each do |call|
  3. AutoScore.score_call(call)
  4. end
  5.  
  6. ################################################################################
  7. # FIXES
  8. removed_skills = [330, 333, 341, 343]
  9. PermittedCallTypeSkill.where(skill_id: removed_skills).destroy_all
  10.  
  11. bob = CallType.find_by(name: "Book of Business ")
  12. mmm = CallType.find_by(name: "Mad Money Makers ")
  13. if bob
  14. bob.name = "Book of Business"
  15. bob.save
  16. end
  17. if mmm
  18. mmm.name = "Mad Money Makers"
  19. mmm.save
  20. end
  21.  
  22. User.all.each do |u|
  23. u.email = u.email.strip
  24. u.first_name = u.first_name.strip
  25. u.last_name = u.last_name.strip
  26. if u.changed?
  27. puts "ID: #{u.id} EMAIL: #{u.email} COMPANY: #{u.company_id}"
  28. end
  29. u.save
  30. end
  31. puts "done."
  32. ################################################################################
  33.  
  34. cts = CallType.all.pluck(:id, :name, :company_id).take(3)
  35. comps = Company.where(active: true)
  36. # comps = Company.where(name: "SV Academy")
  37.  
  38. comps.each do |comp|
  39. ctu_arr = []
  40. puts "--------------------"
  41. puts comp.name
  42.  
  43. cts = CallType.where(company_id: comp.id)
  44. cts.each do |ct|
  45. next if CallTypeUserMembership.where(call_type_id: ct.id).count == 0
  46.  
  47. ct_u = ct.users
  48. puts "'#{ct.name}': #{ct_u.uniq.count}"
  49. ctu_arr << ct_u.pluck(:id)
  50.  
  51. if Team.find_by(name: ct.name, company_id: ct.company_id).nil?
  52. t = Team.create(company_id: comp.id,
  53. name: ct.name)
  54.  
  55. ct_u.each do |user|
  56. user.team_id = t.id
  57. if !user.valid?
  58. 20.times {p "INVALID"}
  59. p user
  60. end
  61. user.save
  62.  
  63. ctids = Call.where(user_id: user.id).pluck(:call_type_id).uniq
  64. ctids.each do |ctid|
  65. TeamCallType.create(call_type_id: ctid, team_id: t.id)
  66. end
  67. end
  68.  
  69. puts "Created TEAM: #{t.name}"
  70. end
  71.  
  72. # skill_ids = PermittedCallTypeSkill.where(call_type_id: ct.id, disabled: nil).pluck(:skill_id).uniq.sort
  73. # puts "#{skill_ids}"
  74. # skill_ids.each do |sid|
  75. # s = Skill.find(sid)
  76. # puts s.name
  77. # end
  78. end
  79.  
  80. # puts "-"
  81.  
  82. # dup_users = []
  83. # ctu_arr.combination(2).to_a.each do |combo|
  84. # duplicates = combo[0] & combo[1]
  85. # duplicates.each do |id|
  86. # user = User.find(id)
  87. # dup_users << user
  88. # end
  89. # end
  90.  
  91. # dup_users.uniq.each do |user|
  92. # puts "#{user.id} #{user.email}"
  93. # user.call_types.each do |ct|
  94. # puts ct.name
  95. # end
  96. # end
  97.  
  98. end
  99.  
  100. # iesheagoree@squareup.com
  101. # 2
  102. # bcoleman@squareup.com
  103. # 2
  104. # kemata@squareup.com
  105. # 2
  106. # sroberts@intermedia.net
  107. # 2
  108. # juliefisher@securly.com
  109. # 2
  110. # mattmaldonado@securly.com
  111. # 2
  112. # rickduany@securly.com
  113. # 2
  114. # stephenlavender@securly.com
  115. # 2
  116. # stevemyszka@securly.com
  117. # 2
  118. #
  119. # Skill.all.each do |s|
  120. # s2 = Skill.where(name: s.name)
  121. # if s2.count > 1
  122. # s2.pluck(:id)
  123. # puts "#{s.name} #{s2.pluck(:id)}"
  124. # end
  125. # end
  126. # Attempts to schedule a next step [45, 13]
  127. # Pricing [48, 130]
  128. # Offers a discount [53, 306]
  129. # Discount [125, 133, 132]
  130. # Pricing [48, 130]
  131. # Attempts to schedule a next step [45, 13]
  132. # Discount [125, 133, 132]
  133. # Recorded line [184, 345, 370, 399]
  134. # Discount [125, 133, 132]
  135. # Offers a discount [53, 306]
  136. # Recorded line [184, 345, 370, 399]
  137. # Recorded line [184, 345, 370, 399]
  138. # Recorded line [184, 345, 370, 399]
  139. #
  140.  
  141. # --------------------
  142. # intermedia
  143. # -
  144. # 13
  145. # 12
  146. # 'Account managers'
  147. # 6
  148. # 6
  149. # 'Voice account managers'
  150. # -
  151. # 141 sroberts@intermedia.net
  152. # Account managers
  153. # Voice account managers
  154.  
  155. # --------------------
  156. # square
  157. # -
  158. # 24
  159. # 21
  160. # 'Trigger calls'
  161. # 5
  162. # 5
  163. # 'Book of Business'
  164.  
  165. # --------------------
  166. # SV Academy
  167. # -
  168. # 113
  169. # 61
  170. # 'outbound'
  171.  
  172. # --------------------
  173. # weebly
  174. # -
  175. # 34
  176. # 26
  177. # 'chat'
  178. # 44
  179. # 38
  180. # 'phone - inbound'
  181.  
  182. # --------------------
  183. # ICE
  184. # -
  185. # 20
  186. # 19
  187. # 'The Heavy Hitters'
  188. # 12
  189. # 5
  190. # 'Mad Money Makers'
  191.  
  192. # --------------------
  193. # Securly
  194. # -
  195. # 5
  196. # 0
  197. # 'outbound'
  198. # 5
  199. # 5
  200. # 'Voicemail'
  201. # 7
  202. # 7
  203. # 'AEs'
  204.  
  205. # --------------------
  206. # Trident University
  207. # -
  208. # 20
  209. # 20
  210. # 'advisor calls'
  211.  
  212. # --------------------
  213. # SiteLock
  214. # -
  215. # 9
  216. # 9
  217. # 'LXG'
  218. # 7
  219. # 7
  220. # 'Brute Force'
  221. # 6
  222. # 6
  223. # 'Commission Possible'
  224. # 9
  225. # 9
  226. # 'High Rollers'
  227. # 9
  228. # 9
  229. # 'CAPTCHA Amerika'
  230. # 9
  231. # 9
  232. # 'Big Bots'
  233. # 9
  234. # 8
  235. # 'Retention'
  236. # 4
  237. # 4
  238. # 'Nights'
Add Comment
Please, Sign In to add comment