create entry when creating a new service

This commit is contained in:
venusbb
2017-10-25 11:35:13 +01:00
parent 15e3b4171b
commit 8ad98f2806
11 changed files with 107 additions and 67 deletions

View File

@@ -170,8 +170,8 @@ def create_service():
raise InvalidRequest(errors, status_code=400)
# TODO: to be removed when front-end is updated
if 'free_sms_fragment_limit' not in data:
data['free_sms_fragment_limit'] = current_app.config['FREE_SMS_TIER_FRAGMENT_COUNT']
# if 'free_sms_fragment_limit' not in data:
# data['free_sms_fragment_limit'] = current_app.config['FREE_SMS_TIER_FRAGMENT_COUNT']
# validate json with marshmallow
service_schema.load(request.get_json())

View File

@@ -6,6 +6,8 @@ from app.models import (
KEY_TYPE_TEST, KEY_TYPE_TEAM, KEY_TYPE_NORMAL)
from notifications_utils.recipients import allowed_to_send_to
from app.dao.notifications_dao import get_financial_year
from datetime import datetime
def get_recipients_from_request(request_json, key, type):
@@ -51,3 +53,12 @@ def service_allowed_to_send_to(recipient, service, key_type):
whitelist_members
)
)
def get_current_financial_year_start_year():
now = datetime.now()
financial_year_start = now.year
start_date, end_date = get_financial_year(now.year)
if now < start_date:
financial_year_start = financial_year_start - 1
return financial_year_start