From bd7554b13b5f707d1c426b018ac6e94c2c6e06f8 Mon Sep 17 00:00:00 2001 From: James McKinney <26463+jpmckinney@users.noreply.github.com> Date: Sat, 27 Apr 2024 15:46:48 -0400 Subject: [PATCH] fix: We don't want publications without a retrieval frequency to be scheduled every 5 mins --- data_registry/models.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/data_registry/models.py b/data_registry/models.py index 19a1376..dc1aa39 100644 --- a/data_registry/models.py +++ b/data_registry/models.py @@ -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.