mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 15:46:07 -05:00
Character count added and tests passing.
Remove sql restriction for count to not be null.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import math
|
||||
from sqlalchemy import (
|
||||
desc,
|
||||
func
|
||||
@@ -47,6 +48,14 @@ def transactional(func):
|
||||
return commit_or_rollback
|
||||
|
||||
|
||||
def get_character_count_of_content(content, encoding='utf-8'):
|
||||
return len(content.encode(encoding))
|
||||
|
||||
|
||||
def get_sms_message_count(char_count):
|
||||
return 1 if char_count <= 160 else math.ceil(float(char_count) / 153)
|
||||
|
||||
|
||||
def dao_get_notification_statistics_for_service(service_id):
|
||||
return NotificationStatistics.query.filter_by(
|
||||
service_id=service_id
|
||||
|
||||
Reference in New Issue
Block a user