Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change to remove only turned_down applications is good, because currently, it expects that applications are appointed within a week of the application end date, which is not always the case. The status is set to turned_down only when they have been appointed.

)

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.unicore_client import UnicoreClient
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()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So a CRON-job is not supposed to be invoked manually, by definition. Unless there is some issue with django-kronos not installing the CRON-jobs correctly, I don't think there is any problem in terms of remove_old_applications not being called. The crontab on the server looks fine. So I think the change to invoke it without django-kronos should be removed.