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

feat: add business_hours support for sla evaluation #9470

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

vishnu-narayanan
Copy link
Member

@vishnu-narayanan vishnu-narayanan commented May 15, 2024

Pull Request Template

Description

  • Add support for respecting the business_hour setting in SLA policies

Changelog

  • Business hours are used in evaluation only if the inbox configures business hours and a conversation is applied with an SLA policy that has only_during_business_hours set to true.
  • If either inbox or sla_poliicy is missing business_hours, this will be evaluated normally

Fixes https://linear.app/chatwoot/issue/CW-3051/handle-business-hours-during-sla-evaluation

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Add new specs

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented on my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Copy link

linear bot commented May 15, 2024

@vishnu-narayanan vishnu-narayanan temporarily deployed to chatwoot-pr-9470 May 15, 2024 14:01 Inactive
Copy link

🐢 Turtley slow progress alert! This pull request has been idle for over 30 days. Can we please speed things up and either merge it or release it back into the wild?

@github-actions github-actions bot added the stale label Jun 24, 2024
def calculate_threshold(start_time, threshold_seconds)
if @business_hours_configured
if start_time.in_working_hours?
start_time.to_i + threshold_seconds.working.seconds
Copy link

@Sergezdv Sergezdv Jul 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

17:46:48 worker.1   | Error performing Sla::ProcessAppliedSlaJob ... TypeError (WorkingHours::Duration can't be coerced into Integer):
17:46:48 worker.1   | /enterprise/app/services/sla/evaluate_applied_sla_service.rb:57:in `+'
17:46:48 worker.1   | /enterprise/app/services/sla/evaluate_applied_sla_service.rb:57:in `calculate_threshold'
17:46:48 worker.1   | /enterprise/app/services/sla/evaluate_applied_sla_service.rb:67:in `check_first_response_time_threshold'
17:46:48 worker.1   | /enterprise/app/services/sla/evaluate_applied_sla_service.rb:45:in `block in check_sla_thresholds'

maybe
threshold_seconds.working.seconds.since(start_time).to_i
instead
start_time.to_i + threshold_seconds.working.seconds

@github-actions github-actions bot removed the stale label Jul 2, 2024
Copy link

github-actions bot commented Aug 1, 2024

🐢 Turtley slow progress alert! This pull request has been idle for over 30 days. Can we please speed things up and either merge it or release it back into the wild?

@github-actions github-actions bot added the stale label Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants