Skip to content

Commit

Permalink
Added changes to activate cron job that deletes old applications 7 da…
Browse files Browse the repository at this point in the history
…ys after role appointment is done and saved
  • Loading branch information
anandmatt committed Nov 30, 2023
1 parent d76e50a commit b1e4b38
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/involvement/cron.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ def send_extension_emails():
def remove_old_applications():
old_applications = Application.objects.filter(
position__recruitment_end__lte=date.today() - timedelta(days=7)
).exclude(
status='appointed'
).filter(
status='turned_down'
)

for app in old_applications:
Expand Down
2 changes: 2 additions & 0 deletions src/involvement/forms/appointment_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from involvement.models import Application
from utils.forms import AdvancedModelMultipleChoiceField
from utils.melos_client import MelosClient
from involvement import cron


class AppointmentForm(forms.Form):
Expand Down Expand Up @@ -99,3 +100,4 @@ def save(self):
if not created:
appl.status = 'appointed'
appl.save()
cron.remove_old_applications()

0 comments on commit b1e4b38

Please sign in to comment.