diff --git a/models/intermediate/core/int_core__verification_request_completeness.sql b/models/intermediate/core/int_core__verification_request_completeness.sql index 0a57882..4689712 100644 --- a/models/intermediate/core/int_core__verification_request_completeness.sql +++ b/models/intermediate/core/int_core__verification_request_completeness.sql @@ -62,6 +62,13 @@ with left join stg_core__verification_type vt on vstvt.id_verification_type = vt.id_verification_type + -- This hardcode was implement on 2024-05-15 because there is a gap in + -- the backend. CheckInCover is included as a verification in the + -- verification request, but if the client doesn't purchase it, it + -- never gets marked as complete (id_verification_status = 1). + -- We are ignoring it for now until this bug is fixed. Once the bug + -- is fixed, this need to be removed. + where vt.verification_type not in ('CheckInCover') ), same_vr_verification_state as ( select vr.id_verification_request, v.verification, v.id_verification_status @@ -87,7 +94,12 @@ with evt.verification_type, coalesce( t1.id_verification_status, t2.id_verification_status - ) as global_id_verification_status + ) as global_id_verification_status, + case + when coalesce(t1.id_verification_status, t2.id_verification_status) = 1 + then 1 + else 0 + end as verification_is_complete from expected_verification_types evt left join same_vr_verification_state as t1 @@ -103,7 +115,7 @@ select count(1) as expected_verification_count, sum(global_id_verification_status) as confirmed_verification_count, coalesce( - count(1) = sum(global_id_verification_status), false + count(1) = sum(verification_is_complete), false ) as is_verification_request_complete from completeness_summary group by id_verification_request