remove crown stuff

This commit is contained in:
stvnrlly
2022-10-17 20:16:39 +00:00
parent 59732ce137
commit 3fff0fdd84
22 changed files with 168 additions and 195 deletions

View File

@@ -459,15 +459,14 @@ def replay_daily_sorted_count_files(file_extension):
@notify_command(name='populate-organisations-from-file')
@click.option('-f', '--file_name', required=True,
help="Pipe delimited file containing organisation name, sector, crown, argeement_signed, domains")
help="Pipe delimited file containing organisation name, sector, argeement_signed, domains")
def populate_organisations_from_file(file_name):
# [0] organisation name:: name of the organisation insert if organisation is missing.
# [1] sector:: Federal | State only
# [2] crown:: TRUE | FALSE only
# [3] argeement_signed:: TRUE | FALSE
# [4] domains:: comma separated list of domains related to the organisation
# [5] email branding name: name of the default email branding for the org
# [6] letter branding name: name of the default letter branding for the org
# [2] argeement_signed:: TRUE | FALSE
# [3] domains:: comma separated list of domains related to the organisation
# [4] email branding name: name of the default email branding for the org
# [5] letter branding name: name of the default letter branding for the org
# The expectation is that the organisation, organisation_to_service
# and user_to_organisation will be cleared before running this command.
@@ -485,18 +484,17 @@ def populate_organisations_from_file(file_name):
columns = line.split('|')
print(columns)
email_branding = None
email_branding_column = columns[5].strip()
email_branding_column = columns[4].strip()
if len(email_branding_column) > 0:
email_branding = EmailBranding.query.filter(EmailBranding.name == email_branding_column).one()
letter_branding = None
letter_branding_column = columns[6].strip()
letter_branding_column = columns[5].strip()
if len(letter_branding_column) > 0:
letter_branding = LetterBranding.query.filter(LetterBranding.name == letter_branding_column).one()
data = {
'name': columns[0],
'active': True,
'agreement_signed': boolean_or_none(columns[3]),
'crown': boolean_or_none(columns[2]),
'agreement_signed': boolean_or_none(columns[2]),
'organisation_type': columns[1].lower(),
'email_branding_id': email_branding.id if email_branding else None,
'letter_branding_id': letter_branding.id if letter_branding else None
@@ -509,7 +507,7 @@ def populate_organisations_from_file(file_name):
except IntegrityError:
print("duplicate org", org.name)
db.session.rollback()
domains = columns[4].split(',')
domains = columns[3].split(',')
for d in domains:
if len(d.strip()) > 0:
domain = Domain(domain=d.strip(), organisation_id=org.id)