Merged PR 3059: Keep latest booking to product bundle program

# Description

This PR fixes today's issue on dbt test, since we had a duplicated booking in this table.

Technically, according to Daga, a booking can only be overridden with a new program ONLY if the first program was the default BasicScreening, and it's a new bundle containing a Paid Service. Once there's a product bundle applied to a booking that contains a paid service, it cannot be overridden.

Thus in essence, by just keeping the latest update date it will only take into account the potential switch to a paid service, that is what really matters, and cannot change afterwards.

# 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: #22346
This commit is contained in:
Oriol Roqué Paniagua 2024-10-04 13:16:08 +00:00 committed by Pablo Martín
commit f292bc84ba
2 changed files with 3 additions and 1 deletions

View file

@ -26,3 +26,4 @@ inner join
btpb.created_date_utc <= upb.effective_end_date_utc
or upb.effective_end_date_utc is null
)
where btpb.has_no_end_date = true

View file

@ -2758,7 +2758,8 @@ models:
This model contains the information of which booking is linked to a
specific product bundle. It's a subset of all bookings since it only
applies to bookings that come from hosts that have been migrated into
the New Dash.
the New Dash. Only the latest product bundle associated to the booking
is shown.
Note: at this moment, it's not straight-forward to know which product service
is applied in the booking. We only know that a booking is linked to a product