mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-25 18:43:49 +02:00
Add import
This commit is contained in:
parent
5e5626aaba
commit
14b6382a2d
3 changed files with 23 additions and 11 deletions
|
@ -12,12 +12,19 @@ class Command(BaseCommand):
|
|||
help = "Clean up duplicate suborganizations that differ only by spaces and capitalization"
|
||||
|
||||
def handle(self, **kwargs):
|
||||
|
||||
# Maybe we should just do these manually?
|
||||
extra_records_to_delete = [
|
||||
"Assistant Secretary for Preparedness and Response Office of the Secretary",
|
||||
"US Geological Survey",
|
||||
"USDA/OC",
|
||||
]
|
||||
# Step 1: delete duplicates
|
||||
self.delete_suborganization_duplicates()
|
||||
|
||||
def delete_suborganization_duplicates(self, extra_records_to_delete):
|
||||
# Find duplicates
|
||||
duplicates = {}
|
||||
all_suborgs = Suborganization.objects.all()
|
||||
|
||||
for suborg in all_suborgs:
|
||||
# Normalize name by removing extra spaces and converting to lowercase
|
||||
normalized_name = " ".join(suborg.name.split()).lower()
|
||||
|
@ -124,6 +131,4 @@ class Command(BaseCommand):
|
|||
|
||||
except Exception as e:
|
||||
logger.error(f"{TerminalColors.FAIL}Failed to clean up suborganizations: {str(e)}{TerminalColors.ENDC}")
|
||||
|
||||
# Step 2: Add city, state, etc info to existing suborganizations.
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue