Skip to content

Commit

Permalink
fix: We don't want publications without a retrieval frequency to be s…
Browse files Browse the repository at this point in the history
…cheduled every 5 mins
  • Loading branch information
jpmckinney committed Apr 27, 2024
1 parent 29445e0 commit bd7554b
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions data_registry/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,23 +305,16 @@ class UpdateFrequency(models.TextChoices):

def is_out_of_date(self):
"""
A publication is out-of-date if it isn't frozen and doesn't have a retrieval frequency of "never", and one of:
- has never been scheduled
- has no retrieval frequency
- was last scheduled longer ago than the retrieval frequency
A publication is out-of-date if it isn't frozen and has a retrieval frequency other than "never", and either
has never been scheduled or was last scheduled longer ago than the retrieval frequency.
"""
if self.frozen:
return False

# Its retrieval frequency is "never".
if self.retrieval_frequency == self.RetrievalFrequency.NEVER:
# It has no retrieval frequency or the retrieval frequency is "never".
if not self.retrieval_frequency or self.retrieval_frequency == self.RetrievalFrequency.NEVER:
return False

# It has no retrieval frequency.
if not self.retrieval_frequency:
return True

most_recent_job = self.job_set.order_by("-start").first()

# It has never been scheduled.
Expand Down

0 comments on commit bd7554b

Please sign in to comment.