Skip to content

Instantly share code, notes, and snippets.

View austindoeswork's full-sized avatar
🐣
hatchin' a plan

austin austindoeswork

🐣
hatchin' a plan
  • San Francisco
View GitHub Profile
\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
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
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
<!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>
<!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>
<!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>
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
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
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
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)