mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-05 01:11:55 +02:00
build on the terminal helper a bit
This commit is contained in:
parent
4026e9be86
commit
7dafc863c0
2 changed files with 6 additions and 3 deletions
|
@ -19,9 +19,10 @@ class Command(BaseCommand, PopulateScriptTemplate):
|
|||
record.first_ready = record.created_at.date()
|
||||
|
||||
logger.info(
|
||||
f"{TerminalColors.OKCYAN}Updating {record} => first_ready: " f"{record.first_ready}{TerminalColors.OKCYAN}"
|
||||
f"{TerminalColors.OKCYAN}Updating {record} => first_ready: " f"{record.first_ready}{TerminalColors.ENDC}"
|
||||
)
|
||||
|
||||
# check if a transition domain object for this domain name exists, and if so whether
|
||||
# check if a transition domain object for this domain name exists,
|
||||
# and if so whether its first_ready value matches its created_at date
|
||||
def should_update(self, record: Domain) -> bool:
|
||||
return TransitionDomain.objects.filter(domain_name=record.name).exists() and record.first_ready != record.created_at.date()
|
|
@ -188,7 +188,9 @@ class PopulateScriptTemplate(ABC):
|
|||
return f"{TerminalColors.FAIL}" f"Failed to update {record}" f"{TerminalColors.ENDC}"
|
||||
|
||||
def should_skip_record(self, record) -> bool: # noqa
|
||||
"""Defines the condition in which we should skip updating a record. Override as needed."""
|
||||
"""Defines the condition in which we should skip updating a record. Override as needed.
|
||||
The difference between this and Custom_filter is that records matching these conditions
|
||||
*will* be included in the run but will be skipped (and logged as such)."""
|
||||
# By default - don't skip
|
||||
return False
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue