Skip to content

Instantly share code, notes, and snippets.

@austindoeswork
Created September 13, 2018 22:43
Show Gist options
  • Save austindoeswork/75ad3263e29165d08e2e0ae44344370b to your computer and use it in GitHub Desktop.
Save austindoeswork/75ad3263e29165d08e2e0ae44344370b to your computer and use it in GitHub Desktop.
select
case when segments.confidence < 75
then '< 75'
else '> 75' end confidance,
sum(time_spent_working)::float / (sum(duration)::float / 1000.0) secs_per_audio_sec
from segments
inner join calls on calls.id = segments.call_id
where 1=1
and calls.created_at >= date_trunc('year', now())
and EXTRACT(EPOCH FROM current_timestamp-calls.occurred_at)/(3600*24) between 0 and 60
and calls.status = 600
and segments.time_spent_working < segments.duration / 20
and segments.time_spent_working IS NOT NULL
and segments.time_spent_working > 0
group by 1
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment