Merged PR 5010: Adds missing payout amount computation for full consistency
# Description Technically, a payout can be submitted while not in a finished incident state. Likely next step from res perspective is just to close the ticket. This PR just adds two new fields for completion and consistency, and fixes the completion test so it makes sense. # 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. - [ ] I have checked for DRY opportunities with other models and docs. - [ ] I've picked the right materialization for the affected models. # Other - [ ] Check if a full-refresh is required after this PR is merged.
This commit is contained in:
parent
84eda4554f
commit
6e354e7df1
2 changed files with 36 additions and 0 deletions
|
|
@ -235,6 +235,24 @@ select
|
|||
where not is_booking_completed
|
||||
) as not_completed_amount_paid_in_gbp,
|
||||
|
||||
-- Amount paid from completed bookings with finished incidents
|
||||
sum(submitted_payout_amount_in_gbp) filter (
|
||||
where
|
||||
is_booking_completed
|
||||
and has_claim
|
||||
and is_incident_finished
|
||||
and has_submitted_payout
|
||||
) as completed_finished_incidents_amount_paid_in_gbp,
|
||||
|
||||
-- Amount paid from completed bookings with awaiting finish incidents
|
||||
sum(submitted_payout_amount_in_gbp) filter (
|
||||
where
|
||||
is_booking_completed
|
||||
and has_claim
|
||||
and not is_incident_finished
|
||||
and has_submitted_payout
|
||||
) as completed_awaiting_finish_incidents_amount_paid_in_gbp,
|
||||
|
||||
-- Completed with Risk, Incident is finished and with Submitted Payout --
|
||||
-- True Positives - How much did we pay?
|
||||
sum(submitted_payout_amount_in_gbp) filter (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue