Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- puts "FIXES"
- # Call.where(call_type_id: 130).each do |call|
- # AutoScore.score_call(call)
- # end
- ################################################################################
- # FIXES
- removed_skills = [330, 333, 341, 343]
- PermittedCallTypeSkill.where(skill_id: removed_skills).destroy_all
- bob = CallType.find_by(name: "Book of Business ")
- mmm = CallType.find_by(name: "Mad Money Makers ")
- if bob
- bob.name = "Book of Business"
- bob.save
- end
- if mmm
- mmm.name = "Mad Money Makers"
- mmm.save
- end
- User.all.each do |u|
- u.email = u.email.strip
- u.first_name = u.first_name.strip
- u.last_name = u.last_name.strip
- if u.changed?
- puts "ID: #{u.id} EMAIL: #{u.email} COMPANY: #{u.company_id}"
- end
- u.save
- end
- puts "done."
- ################################################################################
- cts = CallType.all.pluck(:id, :name, :company_id).take(3)
- comps = Company.where(active: true)
- # comps = Company.where(name: "SV Academy")
- comps.each do |comp|
- ctu_arr = []
- puts "--------------------"
- puts comp.name
- cts = CallType.where(company_id: comp.id)
- cts.each do |ct|
- next if CallTypeUserMembership.where(call_type_id: ct.id).count == 0
- ct_u = ct.users
- puts "'#{ct.name}': #{ct_u.uniq.count}"
- ctu_arr << ct_u.pluck(:id)
- if Team.find_by(name: ct.name, company_id: ct.company_id).nil?
- t = Team.create(company_id: comp.id,
- name: ct.name)
- ct_u.each do |user|
- user.team_id = t.id
- if !user.valid?
- 20.times {p "INVALID"}
- p user
- end
- user.save
- ctids = Call.where(user_id: user.id).pluck(:call_type_id).uniq
- ctids.each do |ctid|
- TeamCallType.create(call_type_id: ctid, team_id: t.id)
- end
- end
- puts "Created TEAM: #{t.name}"
- end
- # skill_ids = PermittedCallTypeSkill.where(call_type_id: ct.id, disabled: nil).pluck(:skill_id).uniq.sort
- # puts "#{skill_ids}"
- # skill_ids.each do |sid|
- # s = Skill.find(sid)
- # puts s.name
- # end
- end
- # puts "-"
- # dup_users = []
- # ctu_arr.combination(2).to_a.each do |combo|
- # duplicates = combo[0] & combo[1]
- # duplicates.each do |id|
- # user = User.find(id)
- # dup_users << user
- # end
- # end
- # dup_users.uniq.each do |user|
- # puts "#{user.id} #{user.email}"
- # user.call_types.each do |ct|
- # puts ct.name
- # end
- # end
- end
- # iesheagoree@squareup.com
- # 2
- # bcoleman@squareup.com
- # 2
- # kemata@squareup.com
- # 2
- # sroberts@intermedia.net
- # 2
- # juliefisher@securly.com
- # 2
- # mattmaldonado@securly.com
- # 2
- # rickduany@securly.com
- # 2
- # stephenlavender@securly.com
- # 2
- # stevemyszka@securly.com
- # 2
- #
- # Skill.all.each do |s|
- # s2 = Skill.where(name: s.name)
- # if s2.count > 1
- # s2.pluck(:id)
- # puts "#{s.name} #{s2.pluck(:id)}"
- # end
- # end
- # Attempts to schedule a next step [45, 13]
- # Pricing [48, 130]
- # Offers a discount [53, 306]
- # Discount [125, 133, 132]
- # Pricing [48, 130]
- # Attempts to schedule a next step [45, 13]
- # Discount [125, 133, 132]
- # Recorded line [184, 345, 370, 399]
- # Discount [125, 133, 132]
- # Offers a discount [53, 306]
- # Recorded line [184, 345, 370, 399]
- # Recorded line [184, 345, 370, 399]
- # Recorded line [184, 345, 370, 399]
- #
- # --------------------
- # intermedia
- # -
- # 13
- # 12
- # 'Account managers'
- # 6
- # 6
- # 'Voice account managers'
- # -
- # 141 sroberts@intermedia.net
- # Account managers
- # Voice account managers
- # --------------------
- # square
- # -
- # 24
- # 21
- # 'Trigger calls'
- # 5
- # 5
- # 'Book of Business'
- # --------------------
- # SV Academy
- # -
- # 113
- # 61
- # 'outbound'
- # --------------------
- # weebly
- # -
- # 34
- # 26
- # 'chat'
- # 44
- # 38
- # 'phone - inbound'
- # --------------------
- # ICE
- # -
- # 20
- # 19
- # 'The Heavy Hitters'
- # 12
- # 5
- # 'Mad Money Makers'
- # --------------------
- # Securly
- # -
- # 5
- # 0
- # 'outbound'
- # 5
- # 5
- # 'Voicemail'
- # 7
- # 7
- # 'AEs'
- # --------------------
- # Trident University
- # -
- # 20
- # 20
- # 'advisor calls'
- # --------------------
- # SiteLock
- # -
- # 9
- # 9
- # 'LXG'
- # 7
- # 7
- # 'Brute Force'
- # 6
- # 6
- # 'Commission Possible'
- # 9
- # 9
- # 'High Rollers'
- # 9
- # 9
- # 'CAPTCHA Amerika'
- # 9
- # 9
- # 'Big Bots'
- # 9
- # 8
- # 'Retention'
- # 4
- # 4
- # 'Nights'
Add Comment
Please, Sign In to add comment