nhs_central is crown org and also we do not update org type while

updating service anymore.
This commit is contained in:
Pea Tyczynska
2019-07-16 14:56:04 +01:00
parent e4cb56b5d3
commit d89ef0594f
7 changed files with 10 additions and 36 deletions

View File

@@ -106,9 +106,6 @@ def dao_add_service_to_organisation(service, organisation_id):
db.session.add(service)
def dao_get_invited_organisation_user(user_id):
return InvitedOrganisationUser.query.filter_by(id=user_id).one()

View File

@@ -38,6 +38,7 @@ from app.models import (
TemplateRedacted,
User,
VerifyCode,
CROWN_ORGANISATION_TYPES,
EMAIL_TYPE,
INTERNATIONAL_SMS_TYPE,
KEY_TYPE_TEST,
@@ -285,6 +286,8 @@ def dao_create_service(
service.research_mode = False
if organisation:
service.crown = organisation.crown
elif service.organisation_type in CROWN_ORGANISATION_TYPES:
service.crown = True
elif service.organisation_type in (NON_CROWN_ORGANISATION_TYPES + ['nhs']):
service.crown = False
service.count_as_live = not user.platform_admin

View File

@@ -328,7 +328,9 @@ ORGANISATION_TYPES = [
"central", "local", "nhs_central",
"nhs_local", "emergency_service", "school_or_college", "other",
]
NON_CROWN_ORGANISATION_TYPES = ["local", "nhs_central", "nhs_local", "emergency_service", "school_or_college"]
CROWN_ORGANISATION_TYPES = ["nhs_central"]
NON_CROWN_ORGANISATION_TYPES = ["local", "nhs_local", "emergency_service", "school_or_college"]
class OrganisationTypes(db.Model):

View File

@@ -86,7 +86,7 @@ from app.errors import (
)
from app.letters.utils import letter_print_day
from app.models import (
KEY_TYPE_NORMAL, LETTER_TYPE, NON_CROWN_ORGANISATION_TYPES, NOTIFICATION_CANCELLED, Permission, Service,
KEY_TYPE_NORMAL, LETTER_TYPE, NOTIFICATION_CANCELLED, Permission, Service,
EmailBranding, LetterBranding
)
from app.notifications.process_notifications import persist_notification, send_notification_to_queue
@@ -224,9 +224,6 @@ def update_service(service_id):
current_data.update(request.get_json())
service = service_schema.load(current_data).data
org_type = req_json.get('organisation_type', None)
if org_type and service.organisation_type in (NON_CROWN_ORGANISATION_TYPES + ["nhs"]):
service.crown = False
if 'email_branding' in req_json:
email_branding_id = req_json['email_branding']