Skip to content

Commit

Permalink
fix: consider holiday list for SLA
Browse files Browse the repository at this point in the history
  • Loading branch information
shariquerik committed Jan 26, 2024
1 parent 6bdcc08 commit d2d1b09
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def calc_time(
):
res = get_datetime(start_at)
time_needed = duration_seconds
holidays = []
holidays = self.get_holidays()
weekdays = get_weekdays()
workdays = self.get_workdays()
while time_needed:
Expand Down Expand Up @@ -214,3 +214,12 @@ def is_working_time(self, date_time, working_hours):
start_time, end_time = working_hours.get(day_of_week, (0, 0))
date_time = timedelta(hours=date_time.hour, minutes=date_time.minute, seconds=date_time.second)
return start_time <= date_time < end_time

def get_holidays(self):
res = []
if not self.holiday_list:
return res
holiday_list = frappe.get_doc("CRM Holiday List", self.holiday_list)
for row in holiday_list.holidays:
res.append(row.date)
return res

0 comments on commit d2d1b09

Please sign in to comment.