fix: Save date of last checked

Otherwise, ANs will get deactivated in the next night again
This commit is contained in:
moanos [he/him] 2024-11-22 18:50:23 +01:00
parent ec38012ecb
commit 89f74cb709

View File

@ -350,22 +350,22 @@ class AdoptionNotice(models.Model):
def set_closed(self): def set_closed(self):
self.last_checked = timezone.now() self.last_checked = timezone.now()
self.adoptionnoticestatus.set_closed()
self.save() self.save()
self.adoptionnoticestatus.set_closed()
def set_active(self): def set_active(self):
self.last_checked = timezone.now() self.last_checked = timezone.now()
self.save()
if not hasattr(self, 'adoptionnoticestatus'): if not hasattr(self, 'adoptionnoticestatus'):
AdoptionNoticeStatus.create_other(self) AdoptionNoticeStatus.create_other(self)
self.adoptionnoticestatus.set_active() self.adoptionnoticestatus.set_active()
self.save()
def set_unchecked(self): def set_unchecked(self):
self.last_checked = timezone.now() self.last_checked = timezone.now()
self.save()
if not hasattr(self, 'adoptionnoticestatus'): if not hasattr(self, 'adoptionnoticestatus'):
AdoptionNoticeStatus.create_other(self) AdoptionNoticeStatus.create_other(self)
self.adoptionnoticestatus.set_unchecked() self.adoptionnoticestatus.set_unchecked()
self.save()
for subscription in self.get_subscriptions(): for subscription in self.get_subscriptions():
notification_title = _("Vermittlung deaktiviert:") + f" {self}" notification_title = _("Vermittlung deaktiviert:") + f" {self}"