From 9bd72d87a62ffa5723c5502b5a897665fe76c5e4 Mon Sep 17 00:00:00 2001 From: Leo Hemsted Date: Wed, 10 Nov 2021 18:56:35 +0000 Subject: [PATCH] add explanation to ft_billing model i found myself constantly trying to work out what each column means, so i wrote it down --- app/models.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/app/models.py b/app/models.py index c6ebb282a..7b538b80c 100644 --- a/app/models.py +++ b/app/models.py @@ -2069,6 +2069,35 @@ class DailySortedLetter(db.Model): class FactBilling(db.Model): + """ + These are grouped by date, template, notificaiton type, provider, rate_multiplier, international, rate, and postage. + + For SMS: + + rate = cost per billable unit. Will only change when we change our pricing. + rate_multiplier = international rate multiplier as defined in notifications_utils/international_billing_rates.yml + + billable_units = sum of billable units (fragments) for that grouping + notifications_sent = sum of notifications sent for that grouping + + For letters: + + rate = the cost to send a single notification, which will vary based on postage and page count. + rate_multiplier = always 1 + + billable_units = sum of sheets of paper sent for that grouping + notifications_sent = sum of notifications sent for that grouping + + handy letter calculations: + + number_of_sheets_per_letter = billable_units / notifications_sent + letter_cost = notifications_sent * ft_billing.rate + + For emails: + + rate_multiplier = 0 + everything's free! + """ __tablename__ = "ft_billing" bst_date = db.Column(db.Date, nullable=False, primary_key=True, index=True)