From b1e4b3890f779fd2a0a98b090157b75dac074ee6 Mon Sep 17 00:00:00 2001 From: anandmatt Date: Thu, 30 Nov 2023 20:04:24 +0100 Subject: [PATCH 1/5] Added changes to activate cron job that deletes old applications 7 days after role appointment is done and saved --- src/involvement/cron.py | 4 ++-- src/involvement/forms/appointment_form.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/involvement/cron.py b/src/involvement/cron.py index f63ffc14..bdec72fa 100644 --- a/src/involvement/cron.py +++ b/src/involvement/cron.py @@ -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: diff --git a/src/involvement/forms/appointment_form.py b/src/involvement/forms/appointment_form.py index e227334b..cc0d6bcd 100644 --- a/src/involvement/forms/appointment_form.py +++ b/src/involvement/forms/appointment_form.py @@ -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): @@ -99,3 +100,4 @@ def save(self): if not created: appl.status = 'appointed' appl.save() + cron.remove_old_applications() \ No newline at end of file From 3d3d52ce4ea8d23554a5e4b3e5dbc98c9ba9ab15 Mon Sep 17 00:00:00 2001 From: anandmatt Date: Mon, 4 Dec 2023 21:44:08 +0100 Subject: [PATCH 2/5] add newline at end of file --- src/involvement/forms/appointment_form.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/involvement/forms/appointment_form.py b/src/involvement/forms/appointment_form.py index cc0d6bcd..169afc31 100644 --- a/src/involvement/forms/appointment_form.py +++ b/src/involvement/forms/appointment_form.py @@ -100,4 +100,5 @@ def save(self): if not created: appl.status = 'appointed' appl.save() - cron.remove_old_applications() \ No newline at end of file + cron.remove_old_applications() + From f636f17c2f4ce33f799e0a1ba618fc40fd7d2284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20Dym=C3=A9r?= Date: Wed, 6 Dec 2023 18:34:39 +0100 Subject: [PATCH 3/5] Fix build issues --- requirements.txt | 1 + src/involvement/forms/application_form.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 26c27b5a..f011c18d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ +django_recaptcha==3.0.0 Django[argon2]==3.2.17 wagtail==2.16.2 diff --git a/src/involvement/forms/application_form.py b/src/involvement/forms/application_form.py index 67a6c566..76a32954 100644 --- a/src/involvement/forms/application_form.py +++ b/src/involvement/forms/application_form.py @@ -20,4 +20,4 @@ def clean_status(self): or (self.initial['status'] == 'submitted' and status == 'draft'): raise forms.ValidationError(_('The submitted status was invalid.')) - return status + return status \ No newline at end of file From 1bb42426d2d28008dc1b27b4344757592f95025b Mon Sep 17 00:00:00 2001 From: anandmatt Date: Tue, 12 Dec 2023 18:45:40 +0100 Subject: [PATCH 4/5] resolve build errors --- src/involvement/forms/application_form.py | 3 ++- src/involvement/forms/appointment_form.py | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/involvement/forms/application_form.py b/src/involvement/forms/application_form.py index 76a32954..a25a8231 100644 --- a/src/involvement/forms/application_form.py +++ b/src/involvement/forms/application_form.py @@ -20,4 +20,5 @@ def clean_status(self): or (self.initial['status'] == 'submitted' and status == 'draft'): raise forms.ValidationError(_('The submitted status was invalid.')) - return status \ No newline at end of file + return status + \ No newline at end of file diff --git a/src/involvement/forms/appointment_form.py b/src/involvement/forms/appointment_form.py index d861aa9c..32dcea9a 100644 --- a/src/involvement/forms/appointment_form.py +++ b/src/involvement/forms/appointment_form.py @@ -101,4 +101,3 @@ def save(self): appl.status = 'appointed' appl.save() cron.remove_old_applications() - From afe7453db9f06ccef932280f2111fd6708120824 Mon Sep 17 00:00:00 2001 From: anandmatt Date: Tue, 12 Dec 2023 18:55:21 +0100 Subject: [PATCH 5/5] resolve flake build error --- src/involvement/forms/application_form.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/involvement/forms/application_form.py b/src/involvement/forms/application_form.py index a25a8231..67a6c566 100644 --- a/src/involvement/forms/application_form.py +++ b/src/involvement/forms/application_form.py @@ -21,4 +21,3 @@ def clean_status(self): and status == 'draft'): raise forms.ValidationError(_('The submitted status was invalid.')) return status - \ No newline at end of file