calculate billable units when sending an sms

don't calculate it if we're in research mode
* added tests to prove this
* removed last code referring to content_char_count
This commit is contained in:
Leo Hemsted
2016-08-03 16:26:11 +01:00
parent 2793541b9c
commit 527a5c4eaa
9 changed files with 47 additions and 37 deletions

View File

@@ -29,17 +29,7 @@ def get_fragment_count(service_id):
]
sms_count = db.session.query(
func.sum(
case(
[
(
NotificationHistory.content_char_count <= 160,
func.ceil(cast(NotificationHistory.content_char_count, Float) / 153)
)
],
else_=1
)
)
func.sum(NotificationHistory.billable_units)
).filter(
NotificationHistory.notification_type == SMS_TYPE,
*shared_filters