linter fixes

This commit is contained in:
matthewswspence 2024-08-27 15:25:44 -05:00
parent f6e10b6585
commit febd9566ce
No known key found for this signature in database
GPG key ID: FB458202A7852BA4
2 changed files with 14 additions and 14 deletions

View file

@ -4,14 +4,16 @@ from django.db.models.manager import BaseManager
from registrar.management.commands.utility.terminal_helper import PopulateScriptTemplate, TerminalColors
from registrar.models import Domain, TransitionDomain
logger = logging.getLogger(__name__)
class Command(BaseCommand, PopulateScriptTemplate):
help = "Loops through each domain object and populates the last_status_update and first_submitted_date"
def handle(self, **kwargs):
"""Loops through each valid Domain object and updates it's first_ready value if it is out of sync"""
filter_conditions={"state__in":[Domain.State.READY, Domain.State.ON_HOLD, Domain.State.DELETED, Domain.State.UNKNOWN]}
filter_conditions = {"state__in": [Domain.State.READY, Domain.State.ON_HOLD, Domain.State.DELETED]}
self.mass_update_records(Domain, filter_conditions, ["first_ready"], verbose=True)
def update_record(self, record: Domain):
@ -28,7 +30,7 @@ class Command(BaseCommand, PopulateScriptTemplate):
def custom_filter(self, records: BaseManager[Domain]) -> BaseManager[Domain]:
to_include_pks = []
for record in records:
if TransitionDomain.objects.filter(domain_name=record.name).exists() and record.first_ready != record.created_at.date():
if TransitionDomain.objects.filter(domain_name=record.name).exists() and record.first_ready != record.created_at.date(): #noqa
to_include_pks.append(record.pk)
return records.filter(pk__in=to_include_pks)

View file

@ -118,13 +118,13 @@ class PopulateScriptTemplate(ABC):
readable_class_name = self.get_class_name(object_class)
# for use in the execution prompt.
proposed_changes=f"""==Proposed Changes==
proposed_changes = f"""==Proposed Changes==
Number of {readable_class_name} objects to change: {len(records)}
These fields will be updated on each record: {fields_to_update}
"""
if verbose:
proposed_changes=f"""{proposed_changes}
proposed_changes = f"""{proposed_changes}
These records will be updated: {list(records.all())}
"""
@ -187,8 +187,6 @@ class PopulateScriptTemplate(ABC):
Applied to individual records *after* filter_conditions. True means """
return records
class TerminalHelper:
@staticmethod
def log_script_run_summary(