From 1969c83f573e727fe786f3c3005f96c51cd4e8d9 Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Thu, 17 May 2018 10:06:58 +0100 Subject: [PATCH] Fix letter rate bug in migtion --- app/commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/commands.py b/app/commands.py index 841da2eff..3db9de113 100644 --- a/app/commands.py +++ b/app/commands.py @@ -467,7 +467,7 @@ def migrate_data_to_ft_billing(start_date, end_date): coalesce((select rates.rate from rates where n.notification_type = rates.notification_type and n.sent_at > rates.valid_from order by rates.valid_from desc limit 1), 0) as sms_rate, - coalesce((select l.rate from letter_rates l where n.rate_multiplier = l.sheet_count + coalesce((select l.rate from letter_rates l where n.billable_units = l.sheet_count and s.crown = l.crown and n.notification_type='letter'), 0) as letter_rate, coalesce(n.international, false) as international, n.billable_units,