Merged PR 4374: Ensures KYG lite users are excluded from New and Old Dash

# Description

Changes:
* **Main change:** exclusion of KYG lite users of the segmentation of Business Scope. These are "freemium" users, kind of demo users, that shouldn't have any real impact in terms of revenue. These are in New Dash, but do not have a deal. The problem is that we don't want to consider them as New Dash, but the current condition was making them appear as Old Dash. This PR fixes this by handling the logic for backend related models. Note that Xero remains unaffected - this is based on Deal, and these users do not have Deal.
* Small data quality fix I noticed while debugging KYG lite cases. It's better to use the "is upgraded service" from the staging original tables rather than the one with the prices. If a user does not have a currency (which can be the case for KYG lite users), then the coalesce would tag any service as not upgraded, which is not true.

# Checklist

- [X] The edited models and dependants run properly with production data.
- [X] The edited models are sufficiently documented.
- [X] The edited models contain PK tests, and I've ran and passed them.
- [X] I have checked for DRY opportunities with other models and docs.
- [X] I've picked the right materialization for the affected models.

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

Related work items: #27356
This commit is contained in:
Oriol Roqué Paniagua 2025-02-13 09:38:43 +00:00
parent db86f75f75
commit 5382a9b32b
8 changed files with 81 additions and 27 deletions

View file

@ -111,7 +111,7 @@ with
psba.last_chargeable_date_utc) as last_chargeable_date_utc,
bts.is_missing_host_currency_code as is_missing_currency_code,
bts.is_booking_cancelled,
(not pstp.is_default_service) as is_upgraded_service
(not ps.is_default_service) as is_upgraded_service
from int_core__booking_to_service bts
inner join
stg_core__product_service ps
@ -157,7 +157,7 @@ with
ppba.last_chargeable_date_utc,
bts.is_missing_host_currency_code as is_missing_currency_code,
bts.is_booking_cancelled,
(not pptp.is_default_service) as is_upgraded_service
(not pp.is_default_service) as is_upgraded_service
from int_core__booking_to_service bts
inner join
stg_core__protection_plan pp