Skip to content

Commit 1581173

Browse files
authored
Update parking_permit_street_cpz_stress_mc.py (#2199)
add check for is_motorcycle is NULL
1 parent fb5544c commit 1581173

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

scripts/jobs/parking/parking_permit_street_cpz_stress_mc.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
11/02/2025 - add totals for following permit types
2525
permit_type, All Zone, Doctor, Dispensation, Health and Social Care
2626
Leisure centre permit, Community Support Permit
27+
01/04/2025 - add check for is_motorcycle is NULL
2728
*********************************************************************************/
2829
With parking_permit_denormalised_data as (
2930
SELECT *
@@ -155,8 +156,14 @@
155156
street_name
156157
),
157158
/*** get the VRM details to obtain the m/c flag ***/
159+
/*** 01-04-2025 - tidy the code ***/
158160
MC_Permit_Flag as (
159-
SELECT *
161+
SELECT permit_reference, vrm, make, model, fuel, engine_capactiy, co2_emission, colour,
162+
foreign, door_plan, lpg_conversion,
163+
CASE
164+
When length(ltrim(rtrim(is_motorcycle))) = 0 Then 'N'
165+
ELSE ltrim(rtrim(is_motorcycle))
166+
END as is_motorcycle
160167
from "dataplatform-prod-liberator-raw-zone".liberator_permit_vrm_480
161168
WHERE import_date = format_datetime(current_date, 'yyyyMMdd')
162169
),
@@ -193,14 +200,14 @@
193200
AND Permit_type not IN ('Suspension')
194201
AND latest_permit_status not IN ('Cancelled', 'Rejected', 'RENEW_REJECTED')
195202
),
203+
/*** 01-04-2025 - add check for is_motorcycle is NULL ***/
196204
Permits_summ as (
197205
SELECT permit_type,
198206
cpz,
199207
address2 as Street,
200208
cast(count(*) as int) as CurrentPermitTotal
201209
FROM Permits
202-
WHERE r1 = 1
203-
AND is_motorcycle != 'Y'
210+
WHERE r1 = 1 AND is_motorcycle is NULL OR rtrim(ltrim(is_motorcycle)) = 'N'
204211
GROUP BY permit_type,
205212
cpz,
206213
address2

0 commit comments

Comments
 (0)