Adding booking services status
This commit is contained in:
parent
5382a9b32b
commit
43742355f0
2 changed files with 74 additions and 69 deletions
28
macros/count_bookings_by_service_status.sql
Normal file
28
macros/count_bookings_by_service_status.sql
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{% macro count_bookings_by_service_status() %}
|
||||
{% set service_status_map = {
|
||||
"PROTECTED": "number_protected_bookings",
|
||||
"REJECTED": "number_rejected_bookings",
|
||||
"NOCHECKS": "number_no_checks_bookings",
|
||||
"NOFLAGS": "number_no_flags_bookings",
|
||||
"PAID": "number_paid_bookings",
|
||||
"PENDING": "number_pending_bookings",
|
||||
"-": "number_unknown_status_bookings",
|
||||
"PARTIALLY PROTECTED": "number_partially_protected_bookings",
|
||||
"NOT PROTECTED": "number_not_protected_bookings",
|
||||
"NOT PAID": "number_not_paid_bookings",
|
||||
"CONFIRMED": "number_confirmed_bookings",
|
||||
"FORREVIEW": "number_for_review_bookings",
|
||||
"FLAGGED": "number_flagged_bookings",
|
||||
} %}
|
||||
|
||||
{% for status, alias in service_status_map.items() %}
|
||||
count(
|
||||
distinct case
|
||||
when upper(ub.service_status) = '{{ status }}'
|
||||
then (ub.id_booking)
|
||||
else null
|
||||
end
|
||||
) as {{ alias }}
|
||||
{% if not loop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
{% endmacro %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue