This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\timing | |
WITH | |
crs as ( | |
select | |
cr.id as cr_id, | |
cr.numerator_id as cr_nid, | |
cr.denominator_id as cr_did, | |
tct.team_id as team_id, | |
tct.call_type_id as ct_id, | |
u.id as u_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
compound = Compound.where(name: "Scheduled a Callback", | |
uid: "specific_callback_time", | |
highlight: true, | |
description: "Rep scheduled a callback at a specific time").first_or_create | |
call_type_ids = CallType.where(company_id: 42).ids | |
call_type_ids.each do |id| | |
CallTypeCompound.where(call_type_id: id, compound_id: compound.id).first_or_create | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MentionsMailerWorker | |
include Sidekiq::Worker | |
EMAIL_DELAY = 0.minutes | |
def perform | |
grouped_mentions = Mention.where(emailed_at: nil).group_by do |mention| | |
[mention.user, mention.call] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"> | |
<head> | |
<!-- NAME: ANNOUNCE --> | |
<!--[if gte mso 15]> | |
<xml> | |
<o:OfficeDocumentSettings> | |
<o:AllowPNG/> | |
<o:PixelsPerInch>96</o:PixelsPerInch> | |
</o:OfficeDocumentSettings> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"> | |
<head> | |
<!-- NAME: ANNOUNCE --> | |
<!--[if gte mso 15]> | |
<xml> | |
<o:OfficeDocumentSettings> | |
<o:AllowPNG/> | |
<o:PixelsPerInch>96</o:PixelsPerInch> | |
</o:OfficeDocumentSettings> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"> | |
<head> | |
<!-- NAME: ANNOUNCE --> | |
<!--[if gte mso 15]> | |
<xml> | |
<o:OfficeDocumentSettings> | |
<o:AllowPNG/> | |
<o:PixelsPerInch>96</o:PixelsPerInch> | |
</o:OfficeDocumentSettings> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def assign_category(cat, skills = [], outcomes = [], tags = []) | |
skills.each do |id| | |
PrimitiveCategory.where(category_id: cat.id, | |
skill_id: id, | |
primitive_type: "skill").first_or_create | |
end | |
outcomes.each do |id| | |
PrimitiveCategory.where(category_id: cat.id, | |
outcome_id: id, | |
primitive_type: "outcome").first_or_create |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
schedules = CallbackSchedule.where(status: [400, 410]).limit(10) | |
puts schedules.count | |
schedules.each do |s| | |
c = s.call | |
all_callbacks = c.callbacks | |
real_callbacks = all_callbacks.where.not("voicemail = true OR short = true") | |
if real_callbacks.count > 0 | |
s.update_status(200) | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fix_status(call, analysis_status) | |
if call.status == "callback_uploaded" || | |
call.status == "callback_downloaded" || | |
call.status == "callback_analyzed" || | |
!call.status | |
call.update_status("surplus", 2, "AustinConsole") | |
end | |
cb = Callback.find_by(callback_id: call.id) | |
return if !cb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fix_status(call, analysis_status) | |
if call.status == "callback_uploaded" || | |
call.status == "callback_downloaded" || | |
call.status == "callback_analyzed" | |
call.update_status("surplus", 2, "AustinConsole") | |
end | |
cb = Callback.find_by(callback_id: call.id) | |
return if !cb | |
cb.update(analysis_status: analysis_status) |