feat: show all ANs to be checked, not only active ones

This commit is contained in:
moanos [he/him] 2024-10-26 08:52:59 +02:00
parent 0e67b777b5
commit c1e3248cc8
2 changed files with 11 additions and 1 deletions

View File

@ -287,6 +287,12 @@ class AdoptionNotice(models.Model):
return False
return self.adoptionnoticestatus.is_active
@property
def is_to_be_checked(self, include_active=False):
if not hasattr(self, 'adoptionnoticestatus'):
return False
return self.adoptionnoticestatus.is_to_be_checked or (include_active and self.adoptionnoticestatus.is_active)
def set_checked(self):
self.last_checked = datetime.now()
self.save()
@ -353,6 +359,10 @@ class AdoptionNoticeStatus(models.Model):
def is_active(self):
return self.major_status == self.ACTIVE
@property
def is_to_be_checked(self):
return self.major_status == self.DISABLED and self.minor_status == "unchecked"
@staticmethod
def get_minor_choices(major_status):
return AdoptionNoticeStatus.MINOR_STATUS_CHOICES[major_status]

View File

@ -470,7 +470,7 @@ def updatequeue(request):
last_checked_adoption_list = AdoptionNotice.objects.order_by("last_checked")
else:
last_checked_adoption_list = AdoptionNotice.objects.filter(owner=request.user).order_by("last_checked")
adoption_notices = [adoption for adoption in last_checked_adoption_list if adoption.is_active]
adoption_notices = [adoption for adoption in last_checked_adoption_list if adoption.is_active or adoption.is_to_be_checked]
context = {"adoption_notices": adoption_notices}
return render(request, 'fellchensammlung/updatequeue.html', context=context)