Initial deploy setup
deploy / deploy (push) Canceled after 0s

This commit is contained in:
Jens
2026-07-21 14:00:00 +02:00
commit b8091e59bd
285 changed files with 27854 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
from __future__ import annotations
from datetime import timedelta
from django.db.models import Q
from django.utils import timezone
from apps.jobs.models import JobPosting
def update_lifecycle(
*, uncertain_after_days: int = 3, removed_after_days: int = 14
) -> dict[str, int]:
now = timezone.now()
expired = JobPosting.objects.filter(
status__in=[JobPosting.Status.ACTIVE, JobPosting.Status.UNCERTAIN],
valid_through__lt=now,
).update(status=JobPosting.Status.EXPIRED)
uncertain_cutoff = now - timedelta(days=uncertain_after_days)
uncertain = JobPosting.objects.filter(
status=JobPosting.Status.ACTIVE,
last_seen__lt=uncertain_cutoff,
valid_through__isnull=True,
).update(status=JobPosting.Status.UNCERTAIN)
removed_cutoff = now - timedelta(days=removed_after_days)
removed = JobPosting.objects.filter(
Q(status=JobPosting.Status.UNCERTAIN),
last_seen__lt=removed_cutoff,
).update(status=JobPosting.Status.REMOVED)
return {"expired": expired, "uncertain": uncertain, "removed": removed}