· 8 years ago · May 23, 2018, 03:00 AM
1(152.0ms) SET NAMES utf8 COLLATE utf8_unicode_ci, @@SESSION.sql_mode = 'NO_ENGINE_SUBSTITUTION', @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
2 Client Load (149.1ms) SELECT `clients`.* FROM `clients` WHERE `clients`.`id` = 6 LIMIT 1
3 CalendarSchedule Load (149.5ms) SELECT `calendar_schedules`.* FROM `calendar_schedules` WHERE `calendar_schedules`.`client_id` = 6 AND `calendar_schedules`.`id` = 6 ORDER BY `calendar_schedules`.`position` ASC LIMIT 1
4 CallType Load (145.6ms) SELECT `call_types`.* FROM `call_types` WHERE `call_types`.`id` IN (46, 47, 48, 49, 51)
5 CalendarSchedule Load (144.3ms) SELECT `calendar_schedules`.* FROM `calendar_schedules` WHERE `calendar_schedules`.`client_id` = 6 AND `calendar_schedules`.`id` = 6 ORDER BY `calendar_schedules`.`position` ASC LIMIT 1
6 Block Load (145.6ms) SELECT `blocks`.* FROM `blocks` INNER JOIN `block_schedules` ON `blocks`.`block_schedule_id` = `block_schedules`.`id` WHERE `block_schedules`.`id` = 6 AND `blocks`.`id` = 17087 ORDER BY start_date asc, end_date asc LIMIT 1
7 BlockSchedule Load (145.1ms) SELECT `block_schedules`.* FROM `block_schedules` WHERE `block_schedules`.`id` = 6 LIMIT 1
8 PopulationTimeframe Load (144.1ms) SELECT `population_timeframes`.* FROM `population_timeframes` WHERE `population_timeframes`.`client_id` = 6 AND `population_timeframes`.`timeframe_type` = 1 ORDER BY `population_timeframes`.`id` ASC LIMIT 1
9 RuleSet Load (143.1ms) SELECT `rule_sets`.* FROM `rule_sets` WHERE `rule_sets`.`id` = 1530 LIMIT 1
10 Block Load (143.5ms) SELECT `blocks`.* FROM `blocks` INNER JOIN `block_schedules` ON `blocks`.`block_schedule_id` = `block_schedules`.`id` WHERE `block_schedules`.`id` = 6 AND (blocks.start_date >= '2017-10-01' AND blocks.end_date <= '2017-10-31') ORDER BY start_date asc, end_date asc
11INFO : (05-17 19:06:30) phase: Scheduler::Base
12INFO : (05-17 19:06:30) from: 2017-10-01 to: 2017-10-31
13 Rule Load (143.7ms) SELECT `rules`.* FROM `rules` WHERE `rules`.`rule_set_id` = 1530 ORDER BY applied desc, weight desc
14INFO : (05-17 19:06:31) rule configurations: TARGET FIXES TESTING 2
15 - 'Assignments Per Day' applied {"opt1"=>{"applied"=>"1", "value"=>"1"}} weight:5
16 - 'Cumulative Assignment Targets' not applied
17 - 'Cumulative Combined Assignment Targets' not applied
18 - 'Cumulative Daily Assignment Targets' not applied
19 - 'Cumulative Day of Week Targets' not applied
20 - 'Cumulative Hour Targets' not applied
21 - 'Cumulative Point Targets' not applied
22 - 'Cumulative Weekend / Weekday Assignment Targets' not applied
23 - 'Cumulative Weekend / Weekday Combined Assignment Targets' not applied
24 - 'Cumulative Weekend / Weekday Hour Targets' not applied
25 - 'Cumulative Weekend / Weekday Point Targets' not applied
26 - 'Current Assignment Targets' not applied
27 - 'Current Combined Assignment Targets' not applied
28 - 'Current Daily Assignment Targets' not applied
29 - 'Current Day of Week Targets' not applied
30 - 'Current Hour Targets' not applied
31 - 'Current Point Targets' not applied
32 - 'Current Weekend / Weekday Assignment Targets' not applied
33 - 'Current Weekend / Weekday Combined Assignment Targets' not applied
34 - 'Current Weekend / Weekday Hour Targets' not applied
35 - 'Current Weekend / Weekday Point Targets' not applied
36 - 'Pending Call Requests' not applied
37 - 'Pending No-call Requests' not applied
38 - 'Days Between Assignments' not applied
39 - 'Days Between Same Assignment' not applied
40 - 'Unassigned Days' not applied
41 - 'Weeks Between Same Assignment On Same Day Of Week' not applied
42 - 'Weeks Between Same Day Of Week' not applied
43INFO : (05-17 19:06:31) started: Scheduler::Cache::Collector.collect_all
44INFO : (05-17 19:06:31) collect_staffs
45 Staff Load (146.4ms) SELECT DISTINCT `staffs`.* FROM `staffs` INNER JOIN `assign_staff_types` ON `assign_staff_types`.`staff_id` = `staffs`.`id` INNER JOIN `staff_types` ON `staff_types`.`id` = `assign_staff_types`.`staff_type_id` WHERE `staffs`.`client_id` = 6 AND `staffs`.`take_call` = 1 AND `staffs`.`active` = 1 ORDER BY `staffs`.`display_order` ASC, last_name, first_name
46 Client Load (152.6ms) SELECT `clients`.* FROM `clients` WHERE `clients`.`id` = 6
47 StaffSpecialization Load (148.9ms) SELECT `staff_specializations`.* FROM `staff_specializations` WHERE `staff_specializations`.`staff_id` IN (66, 77, 68, 74, 72, 3351, 79, 80, 6913, 81, 65, 18125, 70, 6960, 71, 73, 20694, 75, 18127, 78, 8510)
48 Specialization Load (149.5ms) SELECT `specializations`.* FROM `specializations` WHERE `specializations`.`id` = 7 ORDER BY `specializations`.`priority` ASC
49 StaffCallType Load (291.4ms) SELECT `staff_call_types`.* FROM `staff_call_types` WHERE `staff_call_types`.`staff_id` IN (66, 77, 68, 74, 72, 3351, 79, 80, 6913, 81, 65, 18125, 70, 6960, 71, 73, 20694, 75, 18127, 78, 8510)
50INFO : (05-17 19:06:34) initial eligibles: [66,77,68,74,72,3351,79,80,6913,81,65,18125,70,6960,71,73,20694,75,18127,78,8510]
51INFO : (05-17 19:06:34) collect_call_types
52 CallType Load (147.6ms) SELECT `call_types`.* FROM `call_types` WHERE `call_types`.`client_id` = 6 AND `call_types`.`active` = 1 ORDER BY `call_types`.`display_order` ASC
53INFO : (05-17 19:06:34) initial call types: [46,47,48,49,51,2716,397,1343,1344]
54INFO : (05-17 19:06:34) collect_chain_links
55 ChainLink Load (143.7ms) SELECT `chain_links`.* FROM `chain_links` WHERE `chain_links`.`client_id` = 6
56INFO : (05-17 19:06:34) collect_linkages
57INFO : (05-17 19:06:34) collect_schedules
58 Schedule Load (143.9ms) SELECT `schedules`.* FROM `schedules` WHERE `schedules`.`client_id` = 6 AND (`schedules`.`schedule_on` BETWEEN '2017-10-01' AND '2017-10-31')
59INFO : (05-17 19:06:35) collect_slots
60INFO : (05-17 19:06:35) collect_approved_call_requests
61 Request Load (144.1ms) SELECT `requests`.* FROM `requests` INNER JOIN `staffs` ON `staffs`.`id` = `requests`.`staff_id` WHERE `requests`.`client_id` = 6 AND `requests`.`request_type` = 1 AND `requests`.`status` = 1 AND (`requests`.`schedule_on` BETWEEN '2017-10-01' AND '2017-10-31') ORDER BY requests.schedule_on ASC, staffs.request_priority ASC, requests.created_at ASC
62INFO : (05-17 19:06:35) collect_approved_no_call_requests
63 Request Load (148.8ms) SELECT `requests`.* FROM `requests` WHERE `requests`.`client_id` = 6 AND `requests`.`request_type` = 0 AND `requests`.`status` = 1 AND (`requests`.`schedule_on` BETWEEN '2017-10-01' AND '2017-10-31') ORDER BY requests.schedule_on asc, requests.created_at asc
64INFO : (05-17 19:06:35) finished: Scheduler::Cache::Collector.collect_all
65INFO : (05-17 19:06:35) begin to process requests
66 CallType Load (146.3ms) SELECT `call_types`.* FROM `call_types` WHERE `call_types`.`calendar_schedule_id` = 6 AND `call_types`.`active` = 1
67 (159.9ms) SELECT MAX(blocks.end_date) FROM `published_blocks` INNER JOIN `blocks` ON `blocks`.`id` = `published_blocks`.`block_id` WHERE `published_blocks`.`calendar_schedule_id` = 6 AND ((published_blocks.assignment_ids IS NULL) AND (published_blocks.days_of_week_mask = 127))
68 Request Load (145.0ms) SELECT distinct requests.* FROM `requests` INNER JOIN `request_call_types` ON `request_call_types`.`request_id` = `requests`.`id` WHERE `requests`.`client_id` = 6 AND `requests`.`status` = 1 AND `requests`.`request_type` = 1 AND `request_call_types`.`call_type_id` IN (46, 47, 48, 49, 51, 397, 1343, 1344, 2716) AND (requests.schedule_on > '2017-09-30')
69 SQL (164.4ms) UPDATE `schedules` SET `schedules`.`populate_method` = 'auto_approved_request', `schedules`.`creator_id` = 65 WHERE `schedules`.`client_id` = 6 AND 1=0
70INFO : (05-17 19:06:36) end of requests processing
71 Block Load (143.8ms) SELECT `blocks`.* FROM `blocks` INNER JOIN `block_schedules` ON `blocks`.`block_schedule_id` = `block_schedules`.`id` WHERE `block_schedules`.`id` = 6 AND (blocks.start_date <= '2017-10-31' AND blocks.end_date >= '2017-10-31') ORDER BY start_date asc, end_date asc LIMIT 1
72 Client Load (147.3ms) SELECT `clients`.* FROM `clients` WHERE `clients`.`id` = 6 LIMIT 1
73 (147.9ms) SELECT `autopopulate_exclusions`.`schedule_on`, `autopopulate_exclusions`.`call_type_id` FROM `autopopulate_exclusions` WHERE `autopopulate_exclusions`.`client_id` = 6 AND `autopopulate_exclusions`.`schedule_on` IN ('2017-10-01', '2017-10-02', '2017-10-03', '2017-10-04', '2017-10-05', '2017-10-06', '2017-10-07', '2017-10-08', '2017-10-09', '2017-10-10', '2017-10-11', '2017-10-12', '2017-10-13', '2017-10-14', '2017-10-15', '2017-10-16', '2017-10-17', '2017-10-18', '2017-10-19', '2017-10-20', '2017-10-21', '2017-10-22', '2017-10-23', '2017-10-24', '2017-10-25', '2017-10-26', '2017-10-27', '2017-10-28', '2017-10-29', '2017-10-30', '2017-10-31')
74 (144.1ms) select
75 b.start_date,
76 b.end_date,
77 (pb.assignment_ids IS NULL) as fully_published,
78 concat(pbct.assignment_type, '#', pbct.assignment_id) as assignment_uid,
79 pbct.days_of_week_mask
80 from blocks as b
81 inner join published_blocks as pb
82 on pb.block_id = b.id
83 inner join published_block_call_types as pbct
84 on pbct.published_block_id = pb.id
85 where b.client_id = 6
86 and pb.calendar_schedule_id = 6
87 and b.end_date BETWEEN '2017-10-01' AND '2017-10-31'
88
89INFO : (05-17 19:06:37) <-- clear: 0 - Scheduler::AutoPopulate::Queries::CreateTables
90INFO : (05-17 19:06:37) <-- clear: 1 - Scheduler::AutoPopulate::Queries::AutoPopulateSlots
91INFO : (05-17 19:06:37) <-- clear: 2 - Scheduler::AutoPopulate::Queries::Query003
92INFO : (05-17 19:06:37) <-- clear: 3 - Scheduler::AutoPopulate::Queries::Query005
93INFO : (05-17 19:06:37) <-- clear: 4 - Scheduler::AutoPopulate::Queries::Query01
94INFO : (05-17 19:06:37) <-- clear: 5 - Scheduler::AutoPopulate::Queries::Query012
95INFO : (05-17 19:06:37) <-- clear: 6 - Scheduler::AutoPopulate::Queries::QueryTargets
96INFO : (05-17 19:06:37) <-- clear: 7 - Scheduler::AutoPopulate::Queries::Query013
97INFO : (05-17 19:06:37) <-- clear: 8 - Scheduler::AutoPopulate::Queries::Query014
98INFO : (05-17 19:06:37) <-- clear: 9 - Scheduler::AutoPopulate::Queries::Query015
99INFO : (05-17 19:06:37) <-- clear: 10 - Scheduler::AutoPopulate::Queries::Query02
100INFO : (05-17 19:06:37) <-- clear: 11 - Scheduler::AutoPopulate::Queries::Query03
101INFO : (05-17 19:06:37) <-- clear: 12 - Scheduler::AutoPopulate::Queries::Query04
102INFO : (05-17 19:06:37) <-- clear: 13 - Scheduler::AutoPopulate::Queries::Query045
103INFO : (05-17 19:06:37) <-- clear: 14 - Scheduler::AutoPopulate::Queries::QueryA
104INFO : (05-17 19:06:37) <-- clear: 15 - Scheduler::AutoPopulate::Queries::QueryB
105INFO : (05-17 19:06:37) <-- clear: 16 - Scheduler::AutoPopulate::Queries::Query05
106INFO : (05-17 19:06:37) <-- clear: 17 - Scheduler::AutoPopulate::Queries::Query06
107INFO : (05-17 19:06:37) <-- clear: 18 - Scheduler::AutoPopulate::Queries::Query07
108INFO : (05-17 19:06:37) <-- clear: 19 - Scheduler::AutoPopulate::Queries::Query0702
109INFO : (05-17 19:06:37) <-- clear: 20 - Scheduler::AutoPopulate::Queries::Query0705
110INFO : (05-17 19:06:37) <-- clear: 21 - Scheduler::AutoPopulate::Queries::Query0706
111INFO : (05-17 19:06:37) <-- clear: 22 - Scheduler::AutoPopulate::Queries::Query0707
112INFO : (05-17 19:06:37) <-- clear: 23 - Scheduler::AutoPopulate::Queries::Query0708
113INFO : (05-17 19:06:37) <-- clear: 24 - Scheduler::AutoPopulate::Queries::Query0709
114INFO : (05-17 19:06:37) <-- clear: 25 - Scheduler::AutoPopulate::Queries::Query07_10_AL
115INFO : (05-17 19:06:37) <-- clear: 26 - Scheduler::AutoPopulate::Queries::Query07_10_AL_01
116INFO : (05-17 19:06:37) <-- clear: 27 - Scheduler::AutoPopulate::Queries::Query07_10_AL_02
117INFO : (05-17 19:06:37) <-- clear: 28 - Scheduler::AutoPopulate::Queries::Query07_10_AL_03
118INFO : (05-17 19:06:37) <-- clear: 29 - Scheduler::AutoPopulate::Queries::Query07_10_AL_04
119INFO : (05-17 19:06:37) <-- clear: 30 - Scheduler::AutoPopulate::Queries::Query08
120INFO : (05-17 19:06:37) <-- clear: 31 - Scheduler::AutoPopulate::Queries::Query085
121INFO : (05-17 19:06:37) <-- clear: 32 - Scheduler::AutoPopulate::Queries::Query09
122INFO : (05-17 19:06:37) <-- clear: 33 - Scheduler::AutoPopulate::Queries::Query092
123INFO : (05-17 19:06:37) <-- clear: 34 - Scheduler::AutoPopulate::Queries::Query093
124INFO : (05-17 19:06:37) <-- clear: 35 - Scheduler::AutoPopulate::Queries::Query095
125INFO : (05-17 19:06:37) <-- clear: 36 - Scheduler::AutoPopulate::Queries::Query097
126INFO : (05-17 19:06:37) <-- clear: 37 - Scheduler::AutoPopulate::Queries::Query098
127INFO : (05-17 19:06:37) <-- clear: 38 - Scheduler::AutoPopulate::Queries::Query09_09_AL_01
128INFO : (05-17 19:06:37) <-- clear: 39 - Scheduler::AutoPopulate::Queries::Query09_09_AL_02
129INFO : (05-17 19:06:37) <-- clear: 40 - Scheduler::AutoPopulate::Queries::Query09_12_Points
130INFO : (05-17 19:06:37) <-- clear: 41 - Scheduler::AutoPopulate::Queries::Query09_12_Hours
131INFO : (05-17 19:06:37) <-- clear: 42 - Scheduler::AutoPopulate::Queries::Query10
132INFO : (05-17 19:06:37) <-- clear: 43 - Scheduler::AutoPopulate::Queries::QueryScore02
133INFO : (05-17 19:06:37) <-- clear: 44 - Scheduler::AutoPopulate::Queries::QueryScore03
134INFO : (05-17 19:06:37) <-- clear: 45 - Scheduler::AutoPopulate::Queries::QueryScore04
135INFO : (05-17 19:06:37) <-- clear: 46 - Scheduler::AutoPopulate::Queries::Query11
136INFO : (05-17 19:06:37) <-- clear: 47 - Scheduler::AutoPopulate::Queries::DropTables
137 (160.6ms) DROP TABLE IF EXISTS buffer_annual_hour_targets_2091633648
138 (147.3ms) DROP TABLE IF EXISTS buffer_annual_point_targets_2091633648
139 (145.9ms) DROP TABLE IF EXISTS buffer_annual_targets_staff_totals_2091633648
140 (145.7ms) DROP TABLE IF EXISTS buffer_auto_populate_slots_2091633648
141 (145.0ms) DROP TABLE IF EXISTS buffer_call_days_targets_2091633648
142 (144.7ms) DROP TABLE IF EXISTS buffer_call_type_targets_2091633648
143 (152.4ms) DROP TABLE IF EXISTS buffer_cumulative_cd_targets_2091633648
144 (145.1ms) DROP TABLE IF EXISTS buffer_cumulative_ct_targets_2091633648
145 (144.9ms) DROP TABLE IF EXISTS buffer_cumulative_dow_targets_2091633648
146 (145.1ms) DROP TABLE IF EXISTS buffer_cumulative_hour_targets_2091633648
147 (161.3ms) DROP TABLE IF EXISTS buffer_cumulative_oa_targets_2091633648
148 (144.8ms) DROP TABLE IF EXISTS buffer_cumulative_point_targets_2091633648
149 (145.5ms) DROP TABLE IF EXISTS buffer_current_cd_targets_2091633648
150 (144.8ms) DROP TABLE IF EXISTS buffer_current_ct_targets_2091633648
151 (144.7ms) DROP TABLE IF EXISTS buffer_current_dow_targets_2091633648
152 (151.0ms) DROP TABLE IF EXISTS buffer_current_hour_targets_2091633648
153 (145.7ms) DROP TABLE IF EXISTS buffer_current_oa_targets_2091633648
154 (146.7ms) DROP TABLE IF EXISTS buffer_current_point_targets_2091633648
155 (150.4ms) DROP TABLE IF EXISTS buffer_day_of_week_targets_2091633648
156 (145.7ms) DROP TABLE IF EXISTS buffer_hour_targets_2091633648
157 (144.8ms) DROP TABLE IF EXISTS buffer_linkage_call_days_targets_2091633648
158 (145.3ms) DROP TABLE IF EXISTS buffer_linkage_call_type_targets_2091633648
159 (145.1ms) DROP TABLE IF EXISTS buffer_linkage_targets_2091633648
160 (144.5ms) DROP TABLE IF EXISTS buffer_linkage_hour_targets_2091633648
161 (144.7ms) DROP TABLE IF EXISTS buffer_linkage_point_targets_2091633648
162 (145.7ms) DROP TABLE IF EXISTS buffer_location_privileges_2091633648
163 (145.2ms) DROP TABLE IF EXISTS buffer_periods_2091633648
164 (144.7ms) DROP TABLE IF EXISTS buffer_point_targets_2091633648
165 (145.7ms) DROP TABLE IF EXISTS buffer_schedules_2091633648
166 (145.1ms) DROP TABLE IF EXISTS buffer_target_call_types_2091633648
167 (147.5ms) DROP TABLE IF EXISTS buffer_target_daily_points_2091633648
168 (144.6ms) DROP TABLE IF EXISTS buffer_target_dates_list_2091633648
169 (145.9ms) DROP TABLE IF EXISTS buffer_target_primary_availabilities_2091633648
170 (189.9ms) DROP TABLE IF EXISTS buffer_targets_2091633648
171 (144.6ms) DROP TABLE IF EXISTS buffer_tmp_targets_availabilities_2091633648
172 (161.0ms) DROP TABLE IF EXISTS buffer_tmp_targets_availabilities_exclusions_2091633648
173 (163.6ms) DROP TABLE IF EXISTS buffer_tmp_targets_client_totals_2091633648
174 (158.3ms) DROP TABLE IF EXISTS buffer_tmp_targets_scheduled_2091633648
175 (692.0ms) DROP TABLE IF EXISTS buffer_tmp_targets_staff_totals_2091633648
176 (223.0ms) DROP TABLE IF EXISTS buffer_assignment_limit_call_types_2091633648
177 (167.9ms) DROP TABLE IF EXISTS buffer_assignment_limit_periods_2091633648
178 (626.1ms) DROP TABLE IF EXISTS buffer_assignment_limit_staff_types_2091633648
179 (192.5ms) DROP TABLE IF EXISTS buffer_assignment_limit_staffs_2091633648
180 (179.2ms) DROP TABLE IF EXISTS buffer_auto_populate_slots_2091633648
181 (175.5ms) DROP TABLE IF EXISTS buffer_call_type_assignments_2091633648
182 (163.7ms) DROP TABLE IF EXISTS buffer_combined_availabilities_2091633648
183 (229.5ms) DROP TABLE IF EXISTS buffer_combined_availability_linkages_2091633648
184 (658.0ms) DROP TABLE IF EXISTS buffer_counter_increments_2091633648
185 (159.6ms) DROP TABLE IF EXISTS buffer_linkage_assigned_days_2091633648
186 (172.6ms) DROP TABLE IF EXISTS buffer_linkage_call_type_assignments_2091633648
187 (144.6ms) DROP TABLE IF EXISTS buffer_linkage_dow_targets_2091633648
188 (144.4ms) DROP TABLE IF EXISTS buffer_linkage_patterns_2091633648
189 (146.5ms) DROP TABLE IF EXISTS buffer_linkages_2091633648
190 (145.0ms) DROP TABLE IF EXISTS buffer_location_privileges_2091633648
191 (151.7ms) DROP TABLE IF EXISTS buffer_min_distances_2091633648
192 (145.6ms) DROP TABLE IF EXISTS buffer_negative_relations_2091633648
193 (144.7ms) DROP TABLE IF EXISTS buffer_rule_calc_filters_2091633648
194 (144.5ms) DROP TABLE IF EXISTS buffer_rule_calc_schedules_2091633648
195 (147.8ms) DROP TABLE IF EXISTS buffer_rule_scores_2091633648
196 (146.6ms) DROP TABLE IF EXISTS buffer_rule_scores_with_corrections_2091633648
197 (145.1ms) DROP TABLE IF EXISTS buffer_schedule_linkages_2091633648
198 (146.6ms) DROP TABLE IF EXISTS buffer_schedules_linkage_patterns_2091633648
199 (171.6ms) DROP TABLE IF EXISTS buffer_specialization_daily_counts_2091633648
200 (144.6ms) DROP TABLE IF EXISTS buffer_staff_assigned_days_2091633648
201 (145.9ms) DROP TABLE IF EXISTS buffer_staff_daily_counts_2091633648
202 (145.0ms) DROP TABLE IF EXISTS buffer_staff_specializations_2091633648
203 (147.1ms) DROP TABLE IF EXISTS buffer_static_availabilities_2091633648
204 (144.8ms) DROP TABLE IF EXISTS buffer_target_assignments_2091633648
205 (145.8ms) DROP TABLE IF EXISTS buffer_linkage_assignment_limits_2091633648
206 (145.0ms) DROP TABLE IF EXISTS buffer_staff_assignment_limits_2091633648
207 (158.5ms) DROP TABLE IF EXISTS buffer_assignment_limits_2091633648
208 (148.5ms) delete from buffer_target_dates
209 where session_id = 2091633648
210
211INFO : (05-17 19:06:50) --> fill: 0 - Scheduler::AutoPopulate::Queries::CreateTables
212 (147.5ms) CREATE TABLE IF NOT EXISTS buffer_assignment_limit_call_types_2091633648 LIKE buffer_assignment_limit_call_types
213 (147.5ms) CREATE TABLE IF NOT EXISTS buffer_assignment_limit_periods_2091633648 LIKE buffer_assignment_limit_periods
214 (147.7ms) CREATE TABLE IF NOT EXISTS buffer_assignment_limit_staff_types_2091633648 LIKE buffer_assignment_limit_staff_types
215 (147.8ms) CREATE TABLE IF NOT EXISTS buffer_assignment_limit_staffs_2091633648 LIKE buffer_assignment_limit_staffs
216 (162.6ms) CREATE TABLE IF NOT EXISTS buffer_auto_populate_slots_2091633648 LIKE buffer_auto_populate_slots
217 (147.8ms) CREATE TABLE IF NOT EXISTS buffer_call_type_assignments_2091633648 LIKE buffer_call_type_assignments
218 (148.1ms) CREATE TABLE IF NOT EXISTS buffer_combined_availabilities_2091633648 LIKE buffer_combined_availabilities
219 (162.1ms) CREATE TABLE IF NOT EXISTS buffer_combined_availability_linkages_2091633648 LIKE buffer_combined_availability_linkages
220 (149.2ms) CREATE TABLE IF NOT EXISTS buffer_counter_increments_2091633648 LIKE buffer_counter_increments
221 (147.4ms) CREATE TABLE IF NOT EXISTS buffer_linkage_assigned_days_2091633648 LIKE buffer_linkage_assigned_days
222 (153.4ms) CREATE TABLE IF NOT EXISTS buffer_linkage_call_type_assignments_2091633648 LIKE buffer_linkage_call_type_assignments
223 (147.4ms) CREATE TABLE IF NOT EXISTS buffer_linkage_dow_targets_2091633648 LIKE buffer_linkage_dow_targets
224 (147.8ms) CREATE TABLE IF NOT EXISTS buffer_linkage_patterns_2091633648 LIKE buffer_linkage_patterns
225 (148.4ms) CREATE TABLE IF NOT EXISTS buffer_linkages_2091633648 LIKE buffer_linkages
226 (149.2ms) CREATE TABLE IF NOT EXISTS buffer_location_privileges_2091633648 LIKE buffer_location_privileges
227 (148.1ms) CREATE TABLE IF NOT EXISTS buffer_min_distances_2091633648 LIKE buffer_min_distances
228 (148.1ms) CREATE TABLE IF NOT EXISTS buffer_negative_relations_2091633648 LIKE buffer_negative_relations
229 (147.6ms) CREATE TABLE IF NOT EXISTS buffer_rule_calc_filters_2091633648 LIKE buffer_rule_calc_filters
230 (152.3ms) CREATE TABLE IF NOT EXISTS buffer_rule_calc_schedules_2091633648 LIKE buffer_rule_calc_schedules
231 (147.9ms) CREATE TABLE IF NOT EXISTS buffer_rule_scores_2091633648 LIKE buffer_rule_scores
232 (149.5ms) CREATE TABLE IF NOT EXISTS buffer_rule_scores_with_corrections_2091633648 LIKE buffer_rule_scores_with_corrections
233 (147.9ms) CREATE TABLE IF NOT EXISTS buffer_schedule_linkages_2091633648 LIKE buffer_schedule_linkages
234 (148.0ms) CREATE TABLE IF NOT EXISTS buffer_schedules_linkage_patterns_2091633648 LIKE buffer_schedules_linkage_patterns
235 (147.8ms) CREATE TABLE IF NOT EXISTS buffer_specialization_daily_counts_2091633648 LIKE buffer_specialization_daily_counts
236 (147.7ms) CREATE TABLE IF NOT EXISTS buffer_staff_assigned_days_2091633648 LIKE buffer_staff_assigned_days
237 (149.0ms) CREATE TABLE IF NOT EXISTS buffer_staff_daily_counts_2091633648 LIKE buffer_staff_daily_counts
238 (148.5ms) CREATE TABLE IF NOT EXISTS buffer_staff_specializations_2091633648 LIKE buffer_staff_specializations
239 (147.3ms) CREATE TABLE IF NOT EXISTS buffer_static_availabilities_2091633648 LIKE buffer_static_availabilities
240 (159.7ms) CREATE TABLE IF NOT EXISTS buffer_target_assignments_2091633648 LIKE buffer_target_assignments
241 (183.5ms) CREATE TABLE IF NOT EXISTS buffer_linkage_assignment_limits_2091633648 LIKE buffer_linkage_assignment_limits
242 (193.6ms) CREATE TABLE IF NOT EXISTS buffer_staff_assignment_limits_2091633648 LIKE buffer_staff_assignment_limits
243 (199.5ms) CREATE TABLE IF NOT EXISTS buffer_assignment_limits_2091633648 LIKE buffer_assignment_limits
244 (148.2ms) CREATE TABLE IF NOT EXISTS buffer_annual_hour_targets_2091633648 LIKE buffer_annual_hour_targets
245 (147.8ms) CREATE TABLE IF NOT EXISTS buffer_annual_point_targets_2091633648 LIKE buffer_annual_point_targets
246 (147.9ms) CREATE TABLE IF NOT EXISTS buffer_annual_targets_staff_totals_2091633648 LIKE buffer_annual_targets_staff_totals
247 (145.4ms) CREATE TABLE IF NOT EXISTS buffer_auto_populate_slots_2091633648 LIKE buffer_auto_populate_slots
248 (148.7ms) CREATE TABLE IF NOT EXISTS buffer_call_days_targets_2091633648 LIKE buffer_call_days_targets
249 (148.1ms) CREATE TABLE IF NOT EXISTS buffer_call_type_targets_2091633648 LIKE buffer_call_type_targets
250 (151.1ms) CREATE TABLE IF NOT EXISTS buffer_cumulative_cd_targets_2091633648 LIKE buffer_cumulative_cd_targets
251 (148.0ms) CREATE TABLE IF NOT EXISTS buffer_cumulative_ct_targets_2091633648 LIKE buffer_cumulative_ct_targets
252 (147.7ms) CREATE TABLE IF NOT EXISTS buffer_cumulative_dow_targets_2091633648 LIKE buffer_cumulative_dow_targets
253 (151.1ms) CREATE TABLE IF NOT EXISTS buffer_cumulative_hour_targets_2091633648 LIKE buffer_cumulative_hour_targets
254 (147.3ms) CREATE TABLE IF NOT EXISTS buffer_cumulative_oa_targets_2091633648 LIKE buffer_cumulative_oa_targets
255 (147.4ms) CREATE TABLE IF NOT EXISTS buffer_cumulative_point_targets_2091633648 LIKE buffer_cumulative_point_targets
256 (147.6ms) CREATE TABLE IF NOT EXISTS buffer_current_cd_targets_2091633648 LIKE buffer_current_cd_targets
257 (157.2ms) CREATE TABLE IF NOT EXISTS buffer_current_ct_targets_2091633648 LIKE buffer_current_ct_targets
258 (148.4ms) CREATE TABLE IF NOT EXISTS buffer_current_dow_targets_2091633648 LIKE buffer_current_dow_targets
259 (147.7ms) CREATE TABLE IF NOT EXISTS buffer_current_hour_targets_2091633648 LIKE buffer_current_hour_targets
260 (148.6ms) CREATE TABLE IF NOT EXISTS buffer_current_oa_targets_2091633648 LIKE buffer_current_oa_targets
261 (158.1ms) CREATE TABLE IF NOT EXISTS buffer_current_point_targets_2091633648 LIKE buffer_current_point_targets
262 (147.8ms) CREATE TABLE IF NOT EXISTS buffer_day_of_week_targets_2091633648 LIKE buffer_day_of_week_targets
263 (148.2ms) CREATE TABLE IF NOT EXISTS buffer_hour_targets_2091633648 LIKE buffer_hour_targets
264 (148.2ms) CREATE TABLE IF NOT EXISTS buffer_linkage_call_days_targets_2091633648 LIKE buffer_linkage_call_days_targets
265 (147.7ms) CREATE TABLE IF NOT EXISTS buffer_linkage_call_type_targets_2091633648 LIKE buffer_linkage_call_type_targets
266 (147.3ms) CREATE TABLE IF NOT EXISTS buffer_linkage_targets_2091633648 LIKE buffer_linkage_targets
267 (148.9ms) CREATE TABLE IF NOT EXISTS buffer_linkage_hour_targets_2091633648 LIKE buffer_linkage_hour_targets
268 (157.1ms) CREATE TABLE IF NOT EXISTS buffer_linkage_point_targets_2091633648 LIKE buffer_linkage_point_targets
269 (145.4ms) CREATE TABLE IF NOT EXISTS buffer_location_privileges_2091633648 LIKE buffer_location_privileges
270 (147.7ms) CREATE TABLE IF NOT EXISTS buffer_periods_2091633648 LIKE buffer_periods
271 (147.6ms) CREATE TABLE IF NOT EXISTS buffer_point_targets_2091633648 LIKE buffer_point_targets
272 (147.7ms) CREATE TABLE IF NOT EXISTS buffer_schedules_2091633648 LIKE buffer_schedules
273 (147.4ms) CREATE TABLE IF NOT EXISTS buffer_target_call_types_2091633648 LIKE buffer_target_call_types
274 (147.6ms) CREATE TABLE IF NOT EXISTS buffer_target_daily_points_2091633648 LIKE buffer_target_daily_points
275 (149.7ms) CREATE TABLE IF NOT EXISTS buffer_target_dates_list_2091633648 LIKE buffer_target_dates_list
276 (149.5ms) CREATE TABLE IF NOT EXISTS buffer_target_primary_availabilities_2091633648 LIKE buffer_target_primary_availabilities
277 (149.9ms) CREATE TABLE IF NOT EXISTS buffer_targets_2091633648 LIKE buffer_targets
278 (148.2ms) CREATE TABLE IF NOT EXISTS buffer_tmp_targets_availabilities_2091633648 LIKE buffer_tmp_targets_availabilities
279 (150.6ms) CREATE TABLE IF NOT EXISTS buffer_tmp_targets_availabilities_exclusions_2091633648 LIKE buffer_tmp_targets_availabilities_exclusions
280 (150.0ms) CREATE TABLE IF NOT EXISTS buffer_tmp_targets_client_totals_2091633648 LIKE buffer_tmp_targets_client_totals
281 (149.0ms) CREATE TABLE IF NOT EXISTS buffer_tmp_targets_scheduled_2091633648 LIKE buffer_tmp_targets_scheduled
282 (150.5ms) CREATE TABLE IF NOT EXISTS buffer_tmp_targets_staff_totals_2091633648 LIKE buffer_tmp_targets_staff_totals
283INFO : (05-17 19:07:01) --> fill: 1 - Scheduler::AutoPopulate::Queries::AutoPopulateSlots
284 (144.6ms) select
285 b.start_date,
286 b.end_date,
287 (pb.assignment_ids IS NULL) as fully_published,
288 concat(pbct.assignment_type, '#', pbct.assignment_id) as assignment_uid,
289 pbct.days_of_week_mask
290 from blocks as b
291 inner join published_blocks as pb
292 on pb.block_id = b.id
293 inner join published_block_call_types as pbct
294 on pbct.published_block_id = pb.id
295 where b.client_id = 6
296 and pb.calendar_schedule_id = 6
297 and b.end_date BETWEEN '2017-10-01' AND '2017-10-31'
298
299 AutopopulateExclusion Load (144.7ms) SELECT `autopopulate_exclusions`.* FROM `autopopulate_exclusions` WHERE `autopopulate_exclusions`.`client_id` = 6 AND `autopopulate_exclusions`.`schedule_on` IN ('2017-10-01', '2017-10-02', '2017-10-03', '2017-10-04', '2017-10-05', '2017-10-06', '2017-10-07', '2017-10-08', '2017-10-09', '2017-10-10', '2017-10-11', '2017-10-12', '2017-10-13', '2017-10-14', '2017-10-15', '2017-10-16', '2017-10-17', '2017-10-18', '2017-10-19', '2017-10-20', '2017-10-21', '2017-10-22', '2017-10-23', '2017-10-24', '2017-10-25', '2017-10-26', '2017-10-27', '2017-10-28', '2017-10-29', '2017-10-30', '2017-10-31')
300 (151.9ms) INSERT INTO buffer_auto_populate_slots_2091633648
301 (schedule_on, day_of_week_mask, call_type_id, display_order, should_be_populated)
302 VALUES ('2017-10-01', 1, 46, 0, 1), ('2017-10-01', 1, 48, 3, 1), ('2017-10-02', 2, 46, 0, 1), ('2017-10-02', 2, 47, 2, 1), ('2017-10-02', 2, 48, 3, 1), ('2017-10-02', 2, 49, 4, 1), ('2017-10-02', 2, 51, 7, 1), ('2017-10-03', 4, 46, 0, 1), ('2017-10-03', 4, 47, 2, 1), ('2017-10-03', 4, 48, 3, 1), ('2017-10-03', 4, 49, 4, 1), ('2017-10-03', 4, 51, 7, 1), ('2017-10-04', 8, 46, 0, 1), ('2017-10-04', 8, 47, 2, 1), ('2017-10-04', 8, 48, 3, 1), ('2017-10-04', 8, 49, 4, 1), ('2017-10-04', 8, 51, 7, 1), ('2017-10-05', 16, 46, 0, 1), ('2017-10-05', 16, 47, 2, 1), ('2017-10-05', 16, 48, 3, 1), ('2017-10-05', 16, 49, 4, 1), ('2017-10-05', 16, 51, 7, 1), ('2017-10-06', 32, 46, 0, 1), ('2017-10-06', 32, 47, 2, 1), ('2017-10-06', 32, 48, 3, 1), ('2017-10-06', 32, 49, 4, 1), ('2017-10-06', 32, 51, 7, 1), ('2017-10-07', 64, 46, 0, 1), ('2017-10-07', 64, 48, 3, 1), ('2017-10-08', 1, 46, 0, 1), ('2017-10-08', 1, 48, 3, 1), ('2017-10-09', 2, 46, 0, 1), ('2017-10-09', 2, 47, 2, 1), ('2017-10-09', 2, 48, 3, 1), ('2017-10-09', 2, 49, 4, 1), ('2017-10-09', 2, 51, 7, 1), ('2017-10-10', 4, 46, 0, 1), ('2017-10-10', 4, 47, 2, 1), ('2017-10-10', 4, 48, 3, 1), ('2017-10-10', 4, 49, 4, 1), ('2017-10-10', 4, 51, 7, 1), ('2017-10-11', 8, 46, 0, 1), ('2017-10-11', 8, 47, 2, 1), ('2017-10-11', 8, 48, 3, 1), ('2017-10-11', 8, 49, 4, 1), ('2017-10-11', 8, 51, 7, 1), ('2017-10-12', 16, 46, 0, 1), ('2017-10-12', 16, 47, 2, 1), ('2017-10-12', 16, 48, 3, 1), ('2017-10-12', 16, 49, 4, 1), ('2017-10-12', 16, 51, 7, 1), ('2017-10-13', 32, 46, 0, 1), ('2017-10-13', 32, 47, 2, 1), ('2017-10-13', 32, 48, 3, 1), ('2017-10-13', 32, 49, 4, 1), ('2017-10-13', 32, 51, 7, 1), ('2017-10-14', 64, 46, 0, 1), ('2017-10-14', 64, 48, 3, 1), ('2017-10-15', 1, 46, 0, 1), ('2017-10-15', 1, 48, 3, 1), ('2017-10-16', 2, 46, 0, 1), ('2017-10-16', 2, 47, 2, 1), ('2017-10-16', 2, 48, 3, 1), ('2017-10-16', 2, 49, 4, 1), ('2017-10-16', 2, 51, 7, 1), ('2017-10-17', 4, 46, 0, 1), ('2017-10-17', 4, 47, 2, 1), ('2017-10-17', 4, 48, 3, 1), ('2017-10-17', 4, 49, 4, 1), ('2017-10-17', 4, 51, 7, 1), ('2017-10-18', 8, 46, 0, 1), ('2017-10-18', 8, 47, 2, 1), ('2017-10-18', 8, 48, 3, 1), ('2017-10-18', 8, 49, 4, 1), ('2017-10-18', 8, 51, 7, 1), ('2017-10-19', 16, 46, 0, 1), ('2017-10-19', 16, 47, 2, 1), ('2017-10-19', 16, 48, 3, 1), ('2017-10-19', 16, 49, 4, 1), ('2017-10-19', 16, 51, 7, 1), ('2017-10-20', 32, 46, 0, 1), ('2017-10-20', 32, 47, 2, 1), ('2017-10-20', 32, 48, 3, 1), ('2017-10-20', 32, 49, 4, 1), ('2017-10-20', 32, 51, 7, 1), ('2017-10-21', 64, 46, 0, 1), ('2017-10-21', 64, 48, 3, 1), ('2017-10-22', 1, 46, 0, 1), ('2017-10-22', 1, 48, 3, 1), ('2017-10-23', 2, 46, 0, 1), ('2017-10-23', 2, 47, 2, 1), ('2017-10-23', 2, 48, 3, 1), ('2017-10-23', 2, 49, 4, 1), ('2017-10-23', 2, 51, 7, 1), ('2017-10-24', 4, 46, 0, 1), ('2017-10-24', 4, 47, 2, 1), ('2017-10-24', 4, 48, 3, 1), ('2017-10-24', 4, 49, 4, 1), ('2017-10-24', 4, 51, 7, 1), ('2017-10-25', 8, 46, 0, 1), ('2017-10-25', 8, 47, 2, 1), ('2017-10-25', 8, 48, 3, 1), ('2017-10-25', 8, 49, 4, 1), ('2017-10-25', 8, 51, 7, 1), ('2017-10-26', 16, 46, 0, 1), ('2017-10-26', 16, 47, 2, 1), ('2017-10-26', 16, 48, 3, 1), ('2017-10-26', 16, 49, 4, 1), ('2017-10-26', 16, 51, 7, 1), ('2017-10-27', 32, 46, 0, 1), ('2017-10-27', 32, 47, 2, 1), ('2017-10-27', 32, 48, 3, 1), ('2017-10-27', 32, 49, 4, 1), ('2017-10-27', 32, 51, 7, 1), ('2017-10-28', 64, 46, 0, 1), ('2017-10-28', 64, 48, 3, 1), ('2017-10-29', 1, 46, 0, 1), ('2017-10-29', 1, 48, 3, 1), ('2017-10-30', 2, 46, 0, 1), ('2017-10-30', 2, 47, 2, 1), ('2017-10-30', 2, 48, 3, 1), ('2017-10-30', 2, 49, 4, 1), ('2017-10-30', 2, 51, 7, 1), ('2017-10-31', 4, 46, 0, 1), ('2017-10-31', 4, 47, 2, 1), ('2017-10-31', 4, 48, 3, 1), ('2017-10-31', 4, 49, 4, 1), ('2017-10-31', 4, 51, 7, 1)
303
304INFO : (05-17 19:07:01) --> fill: 2 - Scheduler::AutoPopulate::Queries::Query003
305 (145.1ms) insert into buffer_auto_populate_slots_2091633648/* client_id */ (
306 schedule_on,
307 day_of_week_mask,
308 call_type_id,
309 display_order,
310 should_be_populated
311 )
312 select distinct
313 date_add(
314 auto_populate_slots.schedule_on,
315 interval soft_linkages.offset day
316 ) as schedule_on,
317 (1 << (
318 dayofweek(
319 date_add(
320 auto_populate_slots.schedule_on,
321 interval soft_linkages.offset day
322 )
323 ) - 1
324 )
325 ) as day_of_week_mask,
326 soft_linkages.linked_call_type_id as call_type_id,
327 call_types.display_order,
328 0 as should_be_populated
329 from
330 buffer_auto_populate_slots_2091633648/* client_id */ as auto_populate_slots
331 inner join soft_linkages
332 on auto_populate_slots.call_type_id = soft_linkages.call_type_id
333 and auto_populate_slots.day_of_week_mask = soft_linkages.day_of_week_mask
334 left join buffer_auto_populate_slots_2091633648/* client_id */ as auto_populate_slots_2
335 on date_add(
336 auto_populate_slots.schedule_on,
337 interval soft_linkages.offset day
338 ) = auto_populate_slots_2.schedule_on
339 and soft_linkages.linked_call_type_id = auto_populate_slots_2.call_type_id
340 inner join call_types
341 on soft_linkages.linked_call_type_id = call_types.id
342 where auto_populate_slots_2.id is null
343 order by null
344
345INFO : (05-17 19:07:01) --> fill: 3 - Scheduler::AutoPopulate::Queries::Query005
346 (146.3ms) insert into buffer_auto_populate_slots_2091633648 (
347 schedule_on,
348 day_of_week_mask,
349 call_type_id,
350 display_order,
351 should_be_populated
352 )
353 select distinct
354 date_add(
355 auto_populate_slots.schedule_on,
356 interval linkage_relations.distance_in_days day
357 ) as schedule_on,
358 (1 << (
359 dayofweek(
360 date_add(
361 auto_populate_slots.schedule_on,
362 interval linkage_relations.distance_in_days day
363 )
364 ) - 1
365 )
366 ) as day_of_week_mask,
367 linkage_relations.linked_call_type_id as call_type_id,
368 call_types.display_order,
369 0 as should_be_populated
370 from
371 buffer_auto_populate_slots_2091633648 as auto_populate_slots
372 inner join linkage_relations
373 on auto_populate_slots.call_type_id = linkage_relations.call_type_id
374 and auto_populate_slots.day_of_week_mask = linkage_relations.day_of_week_mask
375 left join buffer_auto_populate_slots_2091633648 as auto_populate_slots_2
376 on date_add(
377 auto_populate_slots.schedule_on,
378 interval linkage_relations.distance_in_days day
379 ) = auto_populate_slots_2.schedule_on
380 and linkage_relations.linked_call_type_id = auto_populate_slots_2.call_type_id
381 inner join call_types
382 on linkage_relations.linked_call_type_id = call_types.id
383 where auto_populate_slots_2.id is null
384 order by null
385
386INFO : (05-17 19:07:01) --> fill: 4 - Scheduler::AutoPopulate::Queries::Query01
387 (146.4ms) insert into linkage_relations (
388 client_id,
389 call_type_id,
390 day_of_week_mask,
391 linked_call_type_id,
392 distance_in_days,
393 linkage_template_id
394 )
395 select distinct
396 6 /* client_id */ as client_id,
397 aps.call_type_id,
398 aps.day_of_week_mask,
399 aps.call_type_id as linked_call_type_id,
400 0 as distance_in_days,
401 coalesce(
402 lr.linkage_template_id,
403 @linkage_template_max := @linkage_template_max + 1
404 ) as linkage_template_id
405 from
406 buffer_auto_populate_slots_2091633648/* client_id */ as aps
407 inner join (
408 select @linkage_template_max := count(distinct linkage_template_id) - 1
409 from linkage_relations
410 where client_id = 6 /* client_id */
411 order by null
412 ) as lt
413 on 1 = 1
414 left join linkage_relations as lr use index (ix_linkage_relations_composite1)
415 on aps.call_type_id = lr.call_type_id
416 and aps.day_of_week_mask = lr.day_of_week_mask
417 left join linkage_relations as lr_2 use index (ix_linkage_relations_composite1)
418 on aps.call_type_id = lr_2.call_type_id
419 and aps.day_of_week_mask = lr_2.day_of_week_mask
420 and aps.call_type_id = lr_2.linked_call_type_id
421 and lr_2.distance_in_days = 0
422 where lr_2.id is null
423 order by null
424
425 (285.2ms) insert into buffer_schedules_2091633648 (
426 call_type_id,
427 staff_id,
428 schedule_on,
429 day_of_week_mask,
430 is_weekend,
431 display_order,
432 week_number,
433 should_be_evaluated,
434 should_be_populated,
435 linkage_instance_id
436 )
437 select
438 call_type_id,
439 staff_id,
440 schedule_on,
441 day_of_week_mask,
442 is_weekend,
443 display_order,
444 week_number,
445 max(should_be_evaluated) as should_be_evaluated,
446 max(should_be_populated) as should_be_populated,
447 min(linkage_instance_id) as linkage_instance_id
448 from (
449 select
450 auto_populate_slots_2.call_type_id,
451 schedules.staff_id,
452 auto_populate_slots_2.schedule_on,
453 auto_populate_slots_2.day_of_week_mask,
454 case
455 when (auto_populate_slots_2.day_of_week_mask & 62 > 0) then 0
456 else 1
457 end as is_weekend,
458 auto_populate_slots_2.display_order,
459 yearweek(
460 auto_populate_slots_2.schedule_on,
461 case
462 when (clients.start_of_week = 0) then 2
463 else 7
464 end
465 ) as week_number,
466 case
467 when (schedules.staff_id is null) then 1
468 else 0
469 end as should_be_evaluated,
470 (
471 case
472 when (
473 auto_populate_slots_2.should_be_populated = 1
474 and schedules.staff_id is null
475 ) then 1
476 else 0
477 end
478 ) as should_be_populated,
479 (
480 linkage_relations.linkage_template_id * 1000000 +
481 yearweek(
482 auto_populate_slots.schedule_on,
483 case
484 when (clients.start_of_week = 0) then 2
485 else 7
486 end
487 )
488 ) as linkage_instance_id
489 from
490 buffer_auto_populate_slots_2091633648 as auto_populate_slots
491 inner join clients
492 on clients.id = 6 /* client_id */
493 inner join linkage_relations
494 on auto_populate_slots.call_type_id = linkage_relations.call_type_id
495 and auto_populate_slots.day_of_week_mask = linkage_relations.day_of_week_mask
496 inner join buffer_auto_populate_slots_2091633648 as auto_populate_slots_2
497 on date_add(
498 auto_populate_slots.schedule_on,
499 interval linkage_relations.distance_in_days day
500 ) = auto_populate_slots_2.schedule_on
501 and linkage_relations.linked_call_type_id = auto_populate_slots_2.call_type_id
502 left join schedules
503 on auto_populate_slots_2.call_type_id = schedules.call_type_id
504 and auto_populate_slots_2.schedule_on = schedules.schedule_on
505 order by null
506 ) as t1
507 group by
508 call_type_id,
509 staff_id,
510 schedule_on,
511 day_of_week_mask,
512 display_order,
513 week_number
514 order by null
515
516INFO : (05-17 19:07:02) --> fill: 5 - Scheduler::AutoPopulate::Queries::Query012
517 (176.0ms) update
518 buffer_schedules_2091633648 as sc
519 inner join call_types as ct
520 on sc.call_type_id = ct.id
521 inner join calendar_schedules as cs
522 on ct.calendar_schedule_id = cs.id
523 inner join blocks as b
524 on cs.block_schedule_id = b.block_schedule_id
525 and sc.schedule_on between b.start_date and b.end_date
526 set
527 sc.calendar_schedule_id = cs.id,
528 sc.block_id = b.id
529
530 BlockSchedule Load (143.3ms) SELECT `block_schedules`.* FROM `block_schedules` WHERE `block_schedules`.`id` = 6 LIMIT 1
531 (151.3ms) insert into buffer_periods_2091633648 (
532 calendar_schedule_id,
533 block_schedule_id,
534 period_offset,
535 start_block_display_order,
536 end_block_display_order,
537 start_date,
538 end_date,
539 should_be_populated,
540 should_be_evaluated
541 )
542 select
543 t1.calendar_schedule_id,
544 t1.block_schedule_id,
545 t1.period_offset,
546 t2.start_block_display_order,
547 t2.end_block_display_order,
548 t2.start_date,
549 t2.end_date,
550 t1.should_be_populated,
551 t1.should_be_evaluated
552 from (
553 select
554 sc.calendar_schedule_id,
555 b.block_schedule_id,
556 case
557 when ((month(b.start_date) - pt.begin_period) >= 0)
558 then (year(b.start_date) * 100 + (month(b.start_date) - pt.begin_period) div pt.timeframe_type)
559 else
560 ((year(b.start_date) - 1) * 100 + (month(b.start_date) + 12 - pt.begin_period) div pt.timeframe_type)
561 end as period_offset,
562 max(sc.should_be_populated) as should_be_populated,
563 max(sc.should_be_evaluated) as should_be_evaluated
564 from (
565 select
566 sc.block_id,
567 sc.calendar_schedule_id,
568 max(ps.should_be_populated) as should_be_populated,
569 1 as should_be_evaluated
570 from
571 buffer_schedules_2091633648 as sc
572 inner join buffer_auto_populate_slots_2091633648 as ps
573 on sc.schedule_on = ps.schedule_on
574 and sc.call_type_id = ps.call_type_id
575 group by
576 sc.block_id,
577 sc.calendar_schedule_id
578 order by null
579 ) as sc
580 inner join blocks as b
581 on sc.block_id = b.id
582 inner join population_timeframes as pt
583 on pt.client_id = 6
584 and pt.timeframe_type = 1
585 group by
586 sc.calendar_schedule_id,
587 b.block_schedule_id,
588 period_offset
589 order by null
590 ) as t1
591 inner join (
592 select
593 b.block_schedule_id,
594 case
595 when ((month(b.start_date) - pt.begin_period) >= 0)
596 then (year(b.start_date) * 100 + (month(b.start_date) - pt.begin_period) div pt.timeframe_type)
597 else
598 ((year(b.start_date) - 1) * 100 + (month(b.start_date) + 12 - pt.begin_period) div pt.timeframe_type)
599 end as period_offset,
600 min(b.display_order) as start_block_display_order,
601 max(b.display_order) as end_block_display_order,
602 min(b.start_date) as start_date,
603 max(b.end_date) as end_date
604 from
605 blocks as b
606 inner join population_timeframes as pt
607 on pt.client_id = 6
608 and pt.timeframe_type = 1
609 where
610 b.client_id = 6
611 group by
612 b.block_schedule_id,
613 period_offset
614 order by null
615 ) as t2
616 on t1.block_schedule_id = t2.block_schedule_id
617 and t1.period_offset = t2.period_offset
618 order by null
619
620 (146.3ms) update
621 buffer_schedules_2091633648 as sc
622 inner join buffer_periods_2091633648 as p
623 on sc.calendar_schedule_id = p.calendar_schedule_id
624 and sc.schedule_on between p.start_date and p.end_date
625 set sc.period_offset = p.period_offset
626
627INFO : (05-17 19:07:02) --> fill: 6 - Scheduler::AutoPopulate::Queries::QueryTargets
628INFO : (05-17 19:07:02) --> fill: 7 - Scheduler::AutoPopulate::Queries::Query013
629 (169.8ms) insert into buffer_counter_increments_2091633648 (
630 schedule_id,
631 calls,
632 points,
633 hours,
634 affects_cumulative_targets
635 )
636 select
637 sc.id as schedule_id,
638 case
639 when (ct.included_in_targets > 0) then 1
640 else 0
641 end as calls,
642 coalesce(
643 case
644 when (hl.observed_date is null or dp.point is not null) then dp.point
645 else dp_2.point
646 end,
647 0.0
648 ) as points,
649 ct.hours,
650 case
651 when (b.display_order between (t1.timeframe_ending - (2 /* cumulative targets period */ - 1)) and t1.timeframe_ending) then 1
652 else 0
653 end as affects_cumulative_targets
654 from
655 buffer_schedules_2091633648 as sc
656 inner join (
657 select
658 id,
659 included_in_targets,
660 coalesce(
661 timestampdiff(
662 minute,
663 concat('1900-01-01 ', maketime(start_time_hour, start_time_minute, 0)),
664 concat(
665 '1900-01-0',
666 case
667 when ((
668 start_time_hour | start_time_minute | end_time_hour | end_time_minute > 0
669 )
670 and (
671 timediff(
672 maketime(end_time_hour, end_time_minute, 0),
673 maketime(start_time_hour, start_time_minute, 0)
674 ) <= 0
675 )
676 ) then '2'
677 else '1'
678 end,
679 ' ',
680 maketime(end_time_hour, end_time_minute, 0)
681 )
682 ) / 60,
683 0.0
684 ) as hours
685 from call_types
686 where
687 client_id = 6
688 and active = 1
689 order by null
690 ) as ct
691 on sc.call_type_id = ct.id
692 inner join blocks as b
693 on sc.block_id = b.id
694 inner join (
695 select
696 calendar_schedule_id,
697 max(
698 case
699 when (should_be_populated = 1) then end_block_display_order
700 else null
701 end
702 ) as timeframe_ending
703 from buffer_periods_2091633648
704 group by calendar_schedule_id
705 order by null
706 ) as t1
707 on sc.calendar_schedule_id = t1.calendar_schedule_id
708 left join (
709 select
710 hd.observed_date,
711 case
712 when (hd.observed_date > hd.extended_date) then hd.extended_date
713 else hd.observed_date
714 end as date_from,
715 case
716 when (hd.observed_date < hd.extended_date) then hd.extended_date
717 else hd.observed_date
718 end as date_to
719 from
720 holidays as h
721 inner join holiday_dates as hd
722 on h.id = hd.holiday_id
723 inner join (
724 select
725 year(min(schedule_on)) as year_from,
726 year(max(schedule_on)) as year_to
727 from buffer_schedules_2091633648
728 where should_be_evaluated = 1
729 ) as y
730 on hd.year between y.year_from and y.year_to
731 where
732 h.client_id = 6
733 and (
734 h.observed = 1
735 or h.extended = 1
736 )
737 order by null
738 ) as hl
739 on sc.schedule_on between hl.date_from and hl.date_to
740 left join assignment_annotations as aa
741 on ct.id = aa.assignmentable_id
742 and aa.assignmentable_type = 'CallType'
743 and aa.annotation_id = 0 /* annotation = "None" */
744 and aa.applicable = 1
745 left join assignment_annotation_daily_points as dp
746 on aa.id = dp.assignment_annotation_id
747 and case
748 when (hl.observed_date is null) then (dayofweek(sc.schedule_on) - 1)
749 when (sc.schedule_on = hl.observed_date) then 7
750 else 8
751 end = dp.day
752 left join assignment_annotation_daily_points as dp_2
753 on aa.id = dp_2.assignment_annotation_id
754 and (dayofweek(sc.schedule_on) - 1) = dp_2.day
755 where sc.should_be_evaluated = 1
756 order by null
757
758INFO : (05-17 19:07:03) --> fill: 8 - Scheduler::AutoPopulate::Queries::Query014
759 (149.0ms) -- Prepare the information about the blocks we're populating and the linkage patterns which will be used on those blocks
760 insert into buffer_linkage_patterns_2091633648 (
761 period_offset,
762 calendar_schedule_id,
763 block_id,
764 block_start_date,
765 block_start_dow,
766 block_length,
767 linkage_pattern_id,
768 pattern_start_dow,
769 days_before_start,
770 pattern_length,
771 start_offset,
772 iterations_count
773 )
774 select
775 b1.period_offset,
776 b1.calendar_schedule_id,
777 b1.block_id,
778 b2.start_date as block_start_date,
779 dayofweek(b2.start_date) as block_start_dow,
780 (datediff(b2.end_date, b2.start_date) + 1) as block_length,
781 lp.id as linkage_pattern_id,
782 (lp.start_on + 1) as pattern_start_dow,
783 lp.days_before_start,
784 (lp.length * 7) as pattern_length,
785 null as start_offset,
786 null as iterations_count
787 from (
788 select
789 calendar_schedule_id,
790 block_id,
791 period_offset
792 from buffer_schedules_2091633648
793 group by
794 calendar_schedule_id,
795 block_id,
796 period_offset
797 order by null
798 ) as b1
799 inner join blocks as b2
800 on b1.block_id = b2.id
801 inner join linkage_patterns as lp
802 on lp.client_id = 6
803 and b1.calendar_schedule_id = lp.calendar_schedule_id
804 order by null
805
806 (146.8ms) -- Calculate the basic offset ("+" or "-") that will be applied to a linkage pattern if a block and a pattern are starting on different day of week
807 update buffer_linkage_patterns_2091633648
808 set start_offset = if(
809 (pattern_start_dow + (case when (pattern_start_dow < block_start_dow) then 7 else 0 end) - block_start_dow) <= days_before_start,
810 (pattern_start_dow + (case when (pattern_start_dow < block_start_dow) then 7 else 0 end) - block_start_dow),
811 (block_start_dow + (case when (block_start_dow < pattern_start_dow) then 7 else 0 end) - pattern_start_dow) * (-1)
812 )
813
814 (149.0ms) -- In some cases (when a block and a pattern are starting on different day of week or when a pattern is shorter than a block)
815 -- a pattern should be repeated couple of times (in order to cover the entire block)
816 update buffer_linkage_patterns_2091633648
817 set iterations_count =
818 ceiling(
819 (
820 block_length +
821 case
822 when (start_offset < 0) then abs(start_offset)
823 else 0
824 end
825 ) * 1.0 / pattern_length
826 )
827
828 (144.3ms) -- Generate an assignments sequence for every linkage pattern
829 insert into buffer_schedules_linkage_patterns_2091633648 (
830 call_type_id,
831 staff_id,
832 schedule_on,
833 period_offset,
834 day_of_week_mask,
835 display_order,
836 week_number,
837 should_be_evaluated,
838 should_be_populated,
839 linkage_instance_id,
840 block_id,
841 calendar_schedule_id
842 )
843 select
844 lps.assignment_id as call_type_id,
845 null as staff_id,
846 case
847 when (lp.start_offset < 0)
848 then date_add(lp.block_start_date, interval (lp.start_offset + ns.item_number * lp.pattern_length + lps.offset) day)
849 else
850 date_add(lp.block_start_date, interval ((lp.start_offset + ns.item_number * lp.pattern_length + lps.offset) mod lp.block_length) day)
851 end as schedule_on,
852 lp.period_offset,
853 null as day_of_week_mask,
854 null as display_order,
855 null as week_number,
856 0 as should_be_evaluated,
857 0 as should_be_populated,
858 lp.linkage_pattern_id as linkage_instance_id,
859 lp.block_id,
860 lp.calendar_schedule_id
861 from
862 numeric_sequence as ns
863 inner join buffer_linkage_patterns_2091633648 as lp
864 on ns.item_number <= (lp.iterations_count - 1)
865 inner join linkage_pattern_slots as lps
866 on lp.linkage_pattern_id = lps.linkage_pattern_id
867 and lps.assignment_type = 'CallType'
868 where
869 case
870 when (lp.start_offset < 0)
871 then (lp.start_offset + ns.item_number * lp.pattern_length + lps.offset)
872 else
873 (ns.item_number * lp.pattern_length + lps.offset)
874 end between 0 and (lp.block_length - 1)
875 order by null
876
877 (144.8ms) -- Fill the columns that we left blank in the previous "INSERT"
878 update
879 buffer_schedules_linkage_patterns_2091633648 as slp
880 inner join clients as cl
881 on cl.id = 6
882 inner join call_types as ct
883 on slp.call_type_id = ct.id
884 left join buffer_schedules_2091633648 as bs
885 on slp.schedule_on = bs.schedule_on
886 and slp.call_type_id = bs.call_type_id
887 set
888 slp.day_of_week_mask = (1 << (dayofweek(slp.schedule_on) - 1)),
889 slp.display_order = ct.display_order,
890 slp.week_number =
891 yearweek(
892 slp.schedule_on,
893 case
894 when (cl.start_of_week = 0) then 2
895 else 7
896 end
897 ),
898 slp.should_be_evaluated = coalesce(bs.should_be_evaluated, 0),
899 slp.should_be_populated = coalesce(bs.should_be_populated, 0);
900
901 (143.5ms) -- Delete linkage patterns that don't have intersection with assignments we should auto-populate
902 delete slp_1
903 from
904 buffer_schedules_linkage_patterns_2091633648 as slp_1
905 inner join (
906 select linkage_instance_id
907 from buffer_schedules_linkage_patterns_2091633648
908 group by linkage_instance_id
909 having
910 max(should_be_evaluated) = 0
911 and max(should_be_populated) = 0
912 order by null
913 ) as slp_2
914 on slp_1.linkage_instance_id = slp_2.linkage_instance_id
915
916 (144.5ms) -- Use a linkage pattern ID instead of linkage instance ID for those assignments that intersect with linkage patterns
917 update
918 buffer_schedules_linkage_patterns_2091633648 as slp
919 inner join buffer_schedules_2091633648 as bs_1
920 on slp.schedule_on = bs_1.schedule_on
921 and slp.call_type_id = bs_1.call_type_id
922 inner join buffer_schedules_2091633648 as bs_2
923 on bs_1.linkage_instance_id = bs_2.linkage_instance_id
924 set bs_2.linkage_instance_id = slp.linkage_instance_id
925
926 (145.8ms) -- Linkage pattern slots that don't have intersection with auto-populate assignments but are a part of a pattern that has such intersection
927 -- should be copied over to the buffer schedules table (used during the auto-populate process)
928 insert into buffer_schedules_2091633648 (
929 call_type_id,
930 staff_id,
931 schedule_on,
932 period_offset,
933 day_of_week_mask,
934 is_weekend,
935 display_order,
936 week_number,
937 should_be_evaluated,
938 should_be_populated,
939 linkage_instance_id,
940 block_id,
941 calendar_schedule_id
942 )
943 select
944 call_type_id,
945 staff_id,
946 schedule_on,
947 period_offset,
948 day_of_week_mask,
949 case
950 when (day_of_week_mask & 62 > 0) then 0
951 else 1
952 end as is_weekend,
953 display_order,
954 week_number,
955 should_be_evaluated,
956 should_be_populated,
957 linkage_instance_id,
958 block_id,
959 calendar_schedule_id
960 from buffer_schedules_linkage_patterns_2091633648
961 where
962 should_be_evaluated = 0
963 and should_be_populated = 0
964
965INFO : (05-17 19:07:04) --> fill: 9 - Scheduler::AutoPopulate::Queries::Query015
966 (145.3ms) insert into buffer_schedules_2091633648 (
967 call_type_id,
968 staff_id,
969 schedule_on,
970 day_of_week_mask,
971 is_weekend,
972 display_order,
973 should_be_evaluated,
974 should_be_populated,
975 linkage_instance_id
976 )
977 select distinct
978 schedules_call_overlap.call_type_id,
979 schedules_call_overlap.staff_id,
980 schedules_call_overlap.schedule_on,
981 (1 << (dayofweek(schedules_call_overlap.schedule_on) - 1)) as day_of_week_mask,
982 case
983 when (dayofweek(schedules_call_overlap.schedule_on) between 2 and 6) then 0
984 else 1
985 end as is_weekend,
986 call_types.display_order,
987 0 as should_be_evaluated,
988 0 as should_be_populated,
989 -1 as linkage_instance_id
990 from (
991 select schedule_on
992 from buffer_schedules_2091633648
993 where should_be_evaluated = 1
994 group by schedule_on
995 order by null
996 ) as buffer_schedules_1
997 inner join schedules as schedules_call_overlap
998 on schedules_call_overlap.client_id = 6
999 and buffer_schedules_1.schedule_on = schedules_call_overlap.schedule_on
1000 left join buffer_schedules_2091633648 as buffer_schedules_2
1001 on schedules_call_overlap.schedule_on = buffer_schedules_2.schedule_on
1002 and schedules_call_overlap.call_type_id = buffer_schedules_2.call_type_id
1003 inner join call_types
1004 on schedules_call_overlap.call_type_id = call_types.id
1005 where buffer_schedules_2.id is null
1006 order by null
1007
1008INFO : (05-17 19:07:04) --> fill: 10 - Scheduler::AutoPopulate::Queries::Query02
1009INFO : (05-17 19:07:04) --> fill: 11 - Scheduler::AutoPopulate::Queries::Query03
1010INFO : (05-17 19:07:04) --> fill: 12 - Scheduler::AutoPopulate::Queries::Query04
1011INFO : (05-17 19:07:04) --> fill: 13 - Scheduler::AutoPopulate::Queries::Query045
1012INFO : (05-17 19:07:04) --> fill: 14 - Scheduler::AutoPopulate::Queries::QueryA
1013 (151.9ms) insert into buffer_schedules_2091633648 (
1014 call_type_id,
1015 staff_id,
1016 schedule_on,
1017 day_of_week_mask,
1018 is_weekend,
1019 display_order,
1020 should_be_evaluated,
1021 should_be_populated,
1022 linkage_instance_id
1023 )
1024 select distinct straight_join
1025 schedules.call_type_id,
1026 schedules.staff_id,
1027 schedules.schedule_on,
1028 (1 << (dayofweek(schedules.schedule_on) - 1)) as day_of_week_mask,
1029 case
1030 when (dayofweek(schedules.schedule_on) between 2 and 6) then 0
1031 else 1
1032 end as is_weekend,
1033 call_types.display_order,
1034 0 as should_be_evaluated,
1035 0 as should_be_populated,
1036 -1 as linkage_instance_id
1037 from
1038 buffer_schedules_2091633648 as buffer_schedules_1
1039 inner join negative_links_influences use index (ix_unique_links)
1040 on buffer_schedules_1.day_of_week_mask = negative_links_influences.day_of_week_mask
1041 and buffer_schedules_1.call_type_id = negative_links_influences.source_id
1042 and negative_links_influences.source_type = 'CallType'
1043 and negative_links_influences.target_type = 'CallType'
1044 inner join schedules use index (ix_schedules_call_date)
1045 on date_add(
1046 buffer_schedules_1.schedule_on,
1047 interval negative_links_influences.offset day
1048 ) = schedules.schedule_on
1049 and negative_links_influences.target_id = schedules.call_type_id
1050 left join buffer_schedules_2091633648 as buffer_schedules_2 use index (ix_buffer_schedules_composite_1)
1051 on schedules.schedule_on = buffer_schedules_2.schedule_on
1052 and schedules.call_type_id = buffer_schedules_2.call_type_id
1053 inner join call_types
1054 on schedules.call_type_id = call_types.id
1055 where
1056 buffer_schedules_1.linkage_instance_id >= 0
1057 and buffer_schedules_1.should_be_evaluated = 1
1058 and buffer_schedules_2.id is null
1059 order by null
1060
1061INFO : (05-17 19:07:04) --> fill: 15 - Scheduler::AutoPopulate::Queries::QueryB
1062 (151.7ms) insert into buffer_schedules_2091633648 (
1063 call_type_id,
1064 staff_id,
1065 schedule_on,
1066 day_of_week_mask,
1067 is_weekend,
1068 display_order,
1069 should_be_evaluated,
1070 should_be_populated,
1071 linkage_instance_id
1072 )
1073 select distinct straight_join
1074 (-1 * negative_links_influences.target_id) as call_type_id,
1075 vacations.staff_id,
1076 vacations.schedule_on,
1077 (1 << (dayofweek(vacations.schedule_on) - 1)) as day_of_week_mask,
1078 vacations.weekend_on as is_weekend,
1079 -1 as display_order,
1080 0 as should_be_evaluated,
1081 0 as should_be_populated,
1082 -1 as linkage_instance_id
1083 from
1084 buffer_schedules_2091633648 as buffer_schedules_1
1085 inner join negative_links_influences use index (ix_unique_links)
1086 on buffer_schedules_1.day_of_week_mask = negative_links_influences.day_of_week_mask
1087 and buffer_schedules_1.call_type_id = negative_links_influences.source_id
1088 and negative_links_influences.source_type = 'CallType'
1089 and negative_links_influences.target_id > 0
1090 and negative_links_influences.target_type in ('Vacation', 'NonClinicalType')
1091 inner join vacations use index (ix_vacations_on_schedule_and_client)
1092 on vacations.client_id = 6 /* client_id */
1093 and date_add(
1094 buffer_schedules_1.schedule_on,
1095 interval negative_links_influences.offset day
1096 ) = vacations.schedule_on
1097 and negative_links_influences.target_id = vacations.non_clinical_type_id
1098 and vacations.status in (3) /* based on the "non-working requests" settings */
1099 left join buffer_schedules_2091633648 as buffer_schedules_2 use index (ix_buffer_schedules_composite_1)
1100 on vacations.staff_id = buffer_schedules_2.staff_id
1101 and vacations.schedule_on = buffer_schedules_2.schedule_on
1102 and (-1 * negative_links_influences.target_id) = buffer_schedules_2.call_type_id
1103 where
1104 buffer_schedules_1.linkage_instance_id >= 0
1105 and buffer_schedules_1.should_be_evaluated = 1
1106 and buffer_schedules_2.id is null
1107 order by null
1108
1109INFO : (05-17 19:07:04) --> fill: 16 - Scheduler::AutoPopulate::Queries::Query05
1110 (146.6ms) insert into buffer_linkages_2091633648 (
1111 linkage_instance_id,
1112 slots_count_total,
1113 has_conflicts
1114 )
1115 select straight_join
1116 schedules.linkage_instance_id,
1117 count(1) as slots_count_total,
1118 if(linkage_conflicts.linkage_template_id is not null, 1, 0) as has_conflicts
1119 from
1120 buffer_schedules_2091633648 as schedules
1121 left join (
1122 select straight_join
1123 linkage_relations.linkage_template_id
1124 from linkage_relations
1125 inner join negative_links_influences use index (ix_unique_links)
1126 on linkage_relations.day_of_week_mask = negative_links_influences.day_of_week_mask
1127 and linkage_relations.call_type_id = negative_links_influences.source_id
1128 and negative_links_influences.source_type = 'CallType'
1129 and linkage_relations.linked_call_type_id = negative_links_influences.target_id
1130 and negative_links_influences.target_type = 'CallType'
1131 and linkage_relations.distance_in_days = negative_links_influences.offset
1132 where linkage_relations.client_id = 6 /* client_id */
1133 and (
1134 linkage_relations.call_type_id != linkage_relations.linked_call_type_id
1135 or linkage_relations.distance_in_days != 0
1136 )
1137 group by linkage_relations.linkage_template_id
1138 order by null
1139 ) as linkage_conflicts
1140 on (schedules.linkage_instance_id div 1000000) = linkage_conflicts.linkage_template_id
1141 where schedules.linkage_instance_id >= 0
1142 group by
1143 schedules.linkage_instance_id,
1144 has_conflicts
1145 order by null
1146
1147INFO : (05-17 19:07:04) --> fill: 17 - Scheduler::AutoPopulate::Queries::Query06
1148 (156.5ms) insert into buffer_target_assignments_2091633648 (
1149 call_type_id,
1150 target_group_id,
1151 assignment_id,
1152 assignment_type
1153 )
1154 select
1155 t1.call_type_id,
1156 ifnull(tg.id, 0) as target_group_id,
1157 if(tg.id is null, t1.call_type_id, tg.id) as assignment_id,
1158 if(tg.id is null, 'CallType', 'TargetGroup') as assignment_type
1159 from (
1160 select ct.id as call_type_id
1161 from
1162 buffer_schedules_2091633648 as sc
1163 inner join call_types as ct
1164 on sc.call_type_id = ct.id
1165 and ct.active = 1
1166 and ct.included_in_targets > 0
1167 where linkage_instance_id >= 0
1168 group by ct.id
1169 order by null
1170 ) as t1
1171 left join target_group_calls as tgc
1172 on t1.call_type_id = tgc.call_type_id
1173 left join target_groups as tg
1174 on tgc.target_group_id = tg.id
1175 and tg.active = 1
1176 order by null
1177
1178INFO : (05-17 19:07:05) --> fill: 18 - Scheduler::AutoPopulate::Queries::Query07
1179INFO : (05-17 19:07:05) --> fill: 19 - Scheduler::AutoPopulate::Queries::Query0702
1180INFO : (05-17 19:07:05) --> fill: 20 - Scheduler::AutoPopulate::Queries::Query0705
1181 (149.0ms) insert into buffer_linkage_call_type_assignments_2091633648 (
1182 linkage_instance_id,
1183 call_type_id,
1184 is_weekend,
1185 period_offset,
1186 calendar_schedule_id,
1187 max_assignments,
1188 assignments_count
1189 )
1190 select
1191 s.linkage_instance_id,
1192 s.call_type_id,
1193 s.is_weekend,
1194 s.period_offset,
1195 s.calendar_schedule_id,
1196 case
1197 when (s.is_weekend = 0) then ct.max_weekday_assignments
1198 else ct.max_weekend_assignments
1199 end as _max_assignments,
1200 sum(1) as assignments_count
1201 from buffer_schedules_2091633648 as s
1202 inner join call_types as ct
1203 on s.call_type_id = ct.id
1204 and ct.active = 1
1205 and (
1206 ct.max_weekday_assignments is not null
1207 or ct.max_weekend_assignments is not null
1208 )
1209 where s.linkage_instance_id >= 0
1210 and s.staff_id is null
1211 group by
1212 s.linkage_instance_id,
1213 s.call_type_id,
1214 s.is_weekend,
1215 s.period_offset,
1216 s.calendar_schedule_id,
1217 _max_assignments
1218 having _max_assignments >= 0
1219 order by null
1220
1221INFO : (05-17 19:07:05) --> fill: 21 - Scheduler::AutoPopulate::Queries::Query0706
1222 (143.8ms) insert into buffer_call_type_assignments_2091633648 (
1223 staff_id,
1224 call_type_id,
1225 is_weekend,
1226 period_offset,
1227 calendar_schedule_id,
1228 assignments_count
1229 )
1230 select
1231 sc.staff_id,
1232 sc.call_type_id,
1233 sc.weekend_on as is_weekend,
1234 p.period_offset,
1235 p.calendar_schedule_id,
1236 sum(1) as assignments_count
1237 from buffer_periods_2091633648 as p
1238 inner join call_types as ct
1239 on p.calendar_schedule_id = ct.calendar_schedule_id
1240 and ct.active = 1
1241 and (
1242 ct.max_weekday_assignments is not null
1243 or ct.max_weekend_assignments is not null
1244 )
1245 inner join schedules as sc
1246 on ct.id = sc.call_type_id
1247 and sc.schedule_on between p.start_date and p.end_date
1248 and sc.staff_id is not null
1249 where p.should_be_evaluated = 1
1250 group by
1251 sc.staff_id,
1252 sc.call_type_id,
1253 sc.weekend_on,
1254 p.period_offset,
1255 p.calendar_schedule_id
1256 order by null
1257
1258INFO : (05-17 19:07:05) --> fill: 22 - Scheduler::AutoPopulate::Queries::Query0707
1259INFO : (05-17 19:07:05) --> fill: 23 - Scheduler::AutoPopulate::Queries::Query0708
1260 (152.1ms) insert into buffer_linkage_assigned_days_2091633648 (
1261 linkage_instance_id,
1262 period_offset,
1263 week_number,
1264 schedule_on,
1265 is_weekend
1266 )
1267 select distinct
1268 sc.linkage_instance_id,
1269 sc.period_offset,
1270 sc.week_number,
1271 sc.schedule_on,
1272 sc.is_weekend
1273 from
1274 buffer_schedules_2091633648 as sc
1275 inner join call_types as ct
1276 on sc.call_type_id = ct.id
1277 and ct.unassigned_day = 0
1278 where
1279 sc.linkage_instance_id >= 0
1280 and sc.staff_id is null
1281 order by null
1282
1283INFO : (05-17 19:07:05) --> fill: 24 - Scheduler::AutoPopulate::Queries::Query0709
1284INFO : (05-17 19:07:05) --> fill: 25 - Scheduler::AutoPopulate::Queries::Query07_10_AL
1285**Airbrake: closed