Update create_federal_portfolio.py

This commit is contained in:
zandercymatics 2024-08-30 09:35:45 -06:00
parent 47b7ee45cc
commit db16ba284b
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7

View file

@ -127,7 +127,7 @@ class Command(BaseCommand):
# Create new suborgs, as long as they don't exist in the db already # Create new suborgs, as long as they don't exist in the db already
new_suborgs = [] new_suborgs = []
for name in org_names - set(existing_suborgs.values_list("name", flat=True)): for name in org_names - set(existing_suborgs.values_list("name", flat=True)):
# Stored in variables due to linter wanting type information here # Stored in variables due to linter wanting type information here.
portfolio_name: str = portfolio.organization_name if portfolio.organization_name is not None else "" portfolio_name: str = portfolio.organization_name if portfolio.organization_name is not None else ""
if name is not None and name.lower() == portfolio_name.lower(): if name is not None and name.lower() == portfolio_name.lower():
# You can use this to populate location information, when this occurs. # You can use this to populate location information, when this occurs.
@ -138,7 +138,7 @@ class Command(BaseCommand):
) )
TerminalHelper.colorful_logger(logger.warning, TerminalColors.YELLOW, message) TerminalHelper.colorful_logger(logger.warning, TerminalColors.YELLOW, message)
else: else:
new_suborgs.append(Suborganization(name=name, portfolio=portfolio)) new_suborgs.append(Suborganization(name=name, portfolio=portfolio)) # type: ignore
if new_suborgs: if new_suborgs:
Suborganization.objects.bulk_create(new_suborgs) Suborganization.objects.bulk_create(new_suborgs)