Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix/sla-investigations #136

Merged
merged 30 commits into from
Feb 21, 2024
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
e033f14
fixes
fivetran-reneeli Jan 18, 2024
ec2b3a2
update filter
fivetran-reneeli Jan 18, 2024
712df65
changelog
fivetran-reneeli Jan 18, 2024
e316ade
docs
fivetran-reneeli Jan 18, 2024
34e678e
callout in readme that Chat tickets are not supported
fivetran-reneeli Jan 19, 2024
d849797
spaces to create comments
fivetran-joemarkiewicz Jan 19, 2024
635d7ef
updates
fivetran-reneeli Jan 22, 2024
7b29ae0
updates
fivetran-reneeli Jan 22, 2024
38cc9c3
Update CHANGELOG.md
fivetran-reneeli Jan 24, 2024
7ed7f26
updates
fivetran-reneeli Jan 24, 2024
2e87000
docs
fivetran-reneeli Jan 24, 2024
05455d2
fixes
fivetran-reneeli Jan 24, 2024
1ca031f
bugfix/sla-investigations
fivetran-joemarkiewicz Jan 26, 2024
8617d0e
upstream reference changes and additional filter in combined
fivetran-joemarkiewicz Feb 7, 2024
5d14860
schedule filter applied back
fivetran-joemarkiewicz Feb 12, 2024
178adcf
final adjustments
fivetran-joemarkiewicz Feb 15, 2024
0b3e885
final documenation updates
fivetran-joemarkiewicz Feb 15, 2024
1d2484f
buildkite error fixes
fivetran-joemarkiewicz Feb 15, 2024
14fc307
variable for only using schedules
fivetran-joemarkiewicz Feb 15, 2024
ebb1c84
final adjustments
fivetran-joemarkiewicz Feb 15, 2024
2d5ea55
review updates
fivetran-joemarkiewicz Feb 19, 2024
088c7f1
keeping minute over seconds
fivetran-joemarkiewicz Feb 19, 2024
4e788ae
Update CHANGELOG.md
fivetran-joemarkiewicz Feb 20, 2024
a2826a3
changelog update
fivetran-joemarkiewicz Feb 20, 2024
57f674f
Update CHANGELOG.md
fivetran-joemarkiewicz Feb 20, 2024
ce91de6
regen docs
fivetran-joemarkiewicz Feb 20, 2024
4cb535c
Update CHANGELOG.md
fivetran-joemarkiewicz Feb 20, 2024
ccd81fb
release review updates
fivetran-joemarkiewicz Feb 20, 2024
44bf982
last support reference updates
fivetran-joemarkiewicz Feb 21, 2024
2e10d75
Update packages.yml
fivetran-joemarkiewicz Feb 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
updates
fivetran-reneeli committed Jan 22, 2024
commit 635d7effa7e824689755148d09357eb1991343c9
5 changes: 1 addition & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,10 +3,7 @@
[PR #134](https://github.com/fivetran/dbt_zendesk/pull/134) includes the following changes:

## Bug Fixes
- Updated the `int_zendesk__reply_time_combined` model to account for when a ticket is first replied to outside SLA schedules or not yet replied to.

## Under the Hood
- Adjusted the filter used in the `filtered_reply_times` CTE for business hours to account for the aforementioned cases, as these records were mistakenly being filtered out previously.
- Updated the `int_zendesk__reply_time_combined` model to account for when a ticket is first replied to outside SLA schedules or not yet replied to, as these records were mistakenly being filtered out previously.

# dbt_zendesk v0.13.1

22 changes: 13 additions & 9 deletions models/sla_policy/reply_time/int_zendesk__reply_time_combined.sql
Original file line number Diff line number Diff line change
@@ -107,7 +107,8 @@ with reply_time_calendar_hours_sla as (
*,
lead(sla_schedule_start_at) over (partition by ticket_id, sla_policy_name, metric, sla_applied_at order by sla_schedule_start_at) as next_schedule_start,
min(sla_breach_at) over (partition by sla_policy_name, metric, sla_applied_at order by sla_schedule_start_at rows unbounded preceding) as first_sla_breach_at,
coalesce(lag(sum_lapsed_business_minutes) over (partition by sla_policy_name, metric, sla_applied_at order by sla_schedule_start_at), 0) as sum_lapsed_business_minutes_new
coalesce(lag(sum_lapsed_business_minutes) over (partition by sla_policy_name, metric, sla_applied_at order by sla_schedule_start_at), 0) as sum_lapsed_business_minutes_new,
{{ dbt.datediff("sla_schedule_start_at", "agent_reply_at", 'minute') }} as total_runtime_minutes -- total minutes from sla_schedule_start_at and agent reply time, before taking into account SLA end time
from reply_time_breached_at_with_next_reply_timestamp

), filtered_reply_times as (
@@ -138,17 +139,20 @@ with reply_time_calendar_hours_sla as (
or (agent_reply_at is null and next_solved_at is null)
then true
else false
end as is_sla_breached
end as is_sla_breached,
sum_lapsed_business_minutes_new + total_runtime_minutes as total_new_minutes -- add total runtime to sum_lapsed_business_minutes_new (the sum_lapsed_business_minutes from prior row)
from filtered_reply_times
), reply_time_breach as (
select

), reply_time_breach as (
select
*,
case when {{ dbt.datediff("sla_schedule_start_at", "agent_reply_at", 'minute') }} < 0
then 0
else sum_lapsed_business_minutes_new + {{ dbt.datediff("sla_schedule_start_at", "coalesce(agent_reply_at, current_time_check)", 'minute') }}
case when total_runtime_minutes < 0 -- agent has already replied to prior to this SLA schedule
then 0 -- so don't add new minutes to the SLA
when total_new_minutes > sum_lapsed_business_minutes -- if total runtime, regardless of when the SLA schedule ended, is more than the total lapsed business minutes, that means the agent replied after the SLA schedule
then sum_lapsed_business_minutes -- the elapsed time after the SLA end time should not be calculated as part of the business minutes, therefore sla_elapsed_time should only be sum_lapsed_business_minutes
else total_new_minutes -- otherwise, the sla_elapsed_time will be the prior row's sum_lapsed_business_minutes plus the minutes between SLA schedule start and agent_reply_time.
end as sla_elapsed_time
from reply_time_breached_at_remove_old_sla
from reply_time_breached_at_remove_old_sla
)

select *