(self)
| 88 | self.parse_relationship_pp() |
| 89 | |
| 90 | def parse_calendar_pp(self) -> None: |
| 91 | calendars = self.get_json("CALENDAR") |
| 92 | wp_data = self.get_json("WORK_PATTERN") |
| 93 | work_types = self.get_json("EXCEPTIONN") |
| 94 | work_type_ids = [wt["ID"] for wt in work_types if wt["EXCEPTION_TYPE"] == 0] |
| 95 | |
| 96 | for calendar in calendars: |
| 97 | calendar_id = calendar["ID"] |
| 98 | calendar_wp = calendar["DOMINANT_WORK_PATTERN"] |
| 99 | wp_data = self.get_json_with_filter("WORK_PATTERN", "ID", calendar_wp) |
| 100 | wp = AstaCalendarWorkPattern(wp_data[0]["SHIFTS"], work_type_ids) |
| 101 | exceptions = {} |
| 102 | timex = [] |
| 103 | for times in wp.dict_wp: |
| 104 | work_times = timedelta(hours=0) |
| 105 | for daily in times["WorkTimes"]: |
| 106 | fin = daily["Finish"] |
| 107 | strt = daily["Start"] |
| 108 | work_times += timedelta(hours=fin.hour, minutes=fin.minute) - timedelta( |
| 109 | hours=strt.hour, minutes=strt.minute |
| 110 | ) |
| 111 | timex.append(work_times.total_seconds() / (60 * 60)) |
| 112 | |
| 113 | self.calendars[calendar_id] = Calendar( |
| 114 | Name=calendar["NAME"], |
| 115 | Type="NOTDEFINED", |
| 116 | HoursPerDay=max(timex), |
| 117 | StandardWorkWeek=wp.dict_wp, |
| 118 | HolidayOrExceptions=exceptions, |
| 119 | ) |
| 120 | |
| 121 | def parse_bar(self) -> None: |
| 122 | bars = self.get_json("BAR") |
no test coverage detected