|
38 | 38 | 28/04/2024 - refine the 'hangar_can_be_filled' field case statement |
39 | 39 | 26/09/2024 - add hangar location. |
40 | 40 | 04/10/2024 - add additional checks for the waiting list |
| 41 | +04/12/2024 - collect the interim cycle hangar waiting list |
41 | 42 | ******************************************************************************************************************/ |
42 | 43 | /******************************************************************************* |
43 | 44 | Create a comparison between Toms Hangar list and EStreet |
|
105 | 106 | FROM "dataplatform-stg-liberator-raw-zone".liberator_permit_llpg |
106 | 107 | WHERE import_Date = format_datetime(current_date, 'yyyyMMdd')), |
107 | 108 | /******************************************************************************* |
| 109 | +04/12/2024 - interim cycle hangar waiting list |
| 110 | +*******************************************************************************/ |
| 111 | +Interim_Wait as ( |
| 112 | + SELECT * from "parking-raw-zone".interim_cycle_wait_list |
| 113 | + WHERE import_date = (select max(import_date) |
| 114 | + from "parking-raw-zone".interim_cycle_wait_list)), |
| 115 | + |
| 116 | +/*** count the number on the waiting list by hangar ***/ |
| 117 | +Interim_Wait_summary as ( |
| 118 | + SELECT hanger_id, count(*) as Interim_Wait_Total |
| 119 | + FROM Interim_Wait |
| 120 | + GROUP BY hanger_id), |
| 121 | +/******************************************************************************* |
108 | 122 | Cycle Hangar allocation details |
109 | 123 | *******************************************************************************/ |
110 | 124 | Cycle_Hangar_allocation as ( |
|
222 | 236 | LEFT JOIN Alloc_Total as B ON A.hanger_id = B.hanger_id |
223 | 237 | WHERE H1 = 1), |
224 | 238 |
|
| 239 | +/*** 04/12/2024 - change to use the interim waiting list totals ***/ |
225 | 240 | Full_Hangar_Data as ( |
226 | 241 | SELECT |
227 | 242 | A.hanger_id, A.hangar_location, |
228 | 243 | CASE |
229 | 244 | When A.hanger_id = 'new_only' Then 0 |
230 | 245 | ELSE Total_Allocated |
231 | 246 | END as Total_Allocated, |
232 | | - Wait_Total, |
| 247 | + Interim_Wait_Total as Wait_Total, /*** remove Wait_Total,***/ |
233 | 248 | CASE |
234 | 249 | When A.hanger_id = 'new_only' Then 0 |
235 | 250 | ELSE ( 6 - Total_Allocated) |
|
238 | 253 | Max_Date as Latest_Registration_Date |
239 | 254 | FROM allocated_Total as A |
240 | 255 | LEFT JOIN Wait_total as B ON A.hanger_id = B.hanger_id |
241 | | - LEFT JOIN Wait_List_Earlist_Latest as C ON A.hanger_id = C.hanger_id), |
| 256 | + LEFT JOIN Wait_List_Earlist_Latest as C ON A.hanger_id = C.hanger_id |
| 257 | + LEFT JOIN Interim_Wait_summary as D ON A.hanger_id = D.hanger_id), |
242 | 258 |
|
243 | 259 | /** 20-08-2024 Use the de-dupe data NOT TomHangar **/ |
244 | 260 | Hangar_WAit_List as ( |
|
0 commit comments