This commit is contained in:
@@ -68,10 +68,18 @@ class ReminderOutbox(TimeStampedModel):
|
||||
payload = models.JSONField(default=dict)
|
||||
status = models.CharField(max_length=16, choices=Status.choices, default=Status.PENDING)
|
||||
job = models.ForeignKey(
|
||||
"jobs.JobPosting", on_delete=models.SET_NULL, null=True, blank=True, related_name="reminders"
|
||||
"jobs.JobPosting",
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
blank=True,
|
||||
related_name="reminders",
|
||||
)
|
||||
application = models.ForeignKey(
|
||||
"jobs.Application", on_delete=models.SET_NULL, null=True, blank=True, related_name="reminders"
|
||||
"jobs.Application",
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
blank=True,
|
||||
related_name="reminders",
|
||||
)
|
||||
score_run = models.ForeignKey(
|
||||
"jobs.ScoreRun", on_delete=models.SET_NULL, null=True, blank=True, related_name="reminders"
|
||||
|
||||
@@ -15,7 +15,6 @@ from apps.profiles.models import SearchProfile
|
||||
|
||||
from .models import DigestOutbox, ReminderOutbox
|
||||
|
||||
|
||||
TOP_MATCH_MIN_CONFIDENCE = Decimal("0.85")
|
||||
|
||||
|
||||
@@ -27,7 +26,8 @@ def _to_local(profile: SearchProfile, *, now: datetime | None = None) -> datetim
|
||||
|
||||
def _hidden_job_ids(profile: SearchProfile) -> set[str]:
|
||||
return set(
|
||||
str(job_id) for job_id in Feedback.objects.filter(
|
||||
str(job_id)
|
||||
for job_id in Feedback.objects.filter(
|
||||
user=profile.user, action=Feedback.Action.HIDE
|
||||
).values_list("job_id", flat=True)
|
||||
)
|
||||
@@ -35,7 +35,8 @@ def _hidden_job_ids(profile: SearchProfile) -> set[str]:
|
||||
|
||||
def _applied_job_ids(profile: SearchProfile) -> set[str]:
|
||||
return set(
|
||||
str(job_id) for job_id in Application.objects.filter(
|
||||
str(job_id)
|
||||
for job_id in Application.objects.filter(
|
||||
user=profile.user, status=Application.Status.APPLIED
|
||||
).values_list("job_id", flat=True)
|
||||
)
|
||||
@@ -234,7 +235,9 @@ def create_closing_reminders(profile: SearchProfile, *, now=None) -> list[Remind
|
||||
if not profile.reminders_enabled:
|
||||
return []
|
||||
now_local = _to_local(profile, now=now)
|
||||
due_start = datetime.combine(now_local.date(), time.min, tzinfo=now_local.tzinfo).astimezone(UTC)
|
||||
due_start = datetime.combine(now_local.date(), time.min, tzinfo=now_local.tzinfo).astimezone(
|
||||
UTC
|
||||
)
|
||||
due_end = due_start + timedelta(days=1)
|
||||
hidden_ids = _hidden_job_ids(profile)
|
||||
applied_ids = _applied_job_ids(profile)
|
||||
@@ -255,9 +258,7 @@ def create_closing_reminders(profile: SearchProfile, *, now=None) -> list[Remind
|
||||
local_valid_through = (
|
||||
job.valid_through.astimezone(now_local.tzinfo) if job.valid_through else now_local
|
||||
)
|
||||
dedupe_key = (
|
||||
f"closing:{profile.pk}:{job.pk}:{local_valid_through.date().isoformat()}"
|
||||
)
|
||||
dedupe_key = f"closing:{profile.pk}:{job.pk}:{local_valid_through.date().isoformat()}"
|
||||
outboxes.append(
|
||||
_build_reminder_outbox(
|
||||
profile,
|
||||
@@ -324,7 +325,9 @@ def create_follow_up_reminders(profile: SearchProfile, *, now=None) -> list[Remi
|
||||
"employer": application.job.employer_name,
|
||||
"link": application.job.canonical_url,
|
||||
"follow_up_date": (
|
||||
application.follow_up_date.isoformat() if application.follow_up_date else None
|
||||
application.follow_up_date.isoformat()
|
||||
if application.follow_up_date
|
||||
else None
|
||||
),
|
||||
},
|
||||
job=application.job,
|
||||
|
||||
Reference in New Issue
Block a user