From 96f711c3c4e74156a138148c6fb848ede2d5b2a1 Mon Sep 17 00:00:00 2001 From: Mercea Emil Date: Thu, 23 Mar 2023 15:29:24 +0200 Subject: [PATCH 1/5] [ch33349] Email url broken - it doubles up on the host since intervention function also returns a url with the host --- src/etools/applications/partners/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/etools/applications/partners/models.py b/src/etools/applications/partners/models.py index 48beaf8b5f..8e963e9218 100644 --- a/src/etools/applications/partners/models.py +++ b/src/etools/applications/partners/models.py @@ -3270,7 +3270,7 @@ def send_notification(self): 'intervention_number': self.review.intervention.reference_number, 'meeting_date': self.review.meeting_date.strftime('%d-%m-%Y'), 'user_name': self.user.get_full_name(), - 'url': '{}{}'.format(settings.HOST, self.review.intervention.get_frontend_object_url(suffix='review')) + 'url': self.review.intervention.get_frontend_object_url(suffix='review') } send_notification_with_template( From 8cf7d9ca95079a535cf9d7bbe90191a6f20826e6 Mon Sep 17 00:00:00 2001 From: robertavram Date: Mon, 27 Mar 2023 21:24:10 -0400 Subject: [PATCH 2/5] add hardcoded amendment exception --- .../permission_matrix/intervention_permissions.csv | 1 + src/etools/applications/partners/permissions.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/etools/applications/partners/permission_matrix/intervention_permissions.csv b/src/etools/applications/partners/permission_matrix/intervention_permissions.csv index ad4435e556..09a0090246 100644 --- a/src/etools/applications/partners/permission_matrix/intervention_permissions.csv +++ b/src/etools/applications/partners/permission_matrix/intervention_permissions.csv @@ -11,6 +11,7 @@ Field no,Field Name,Group,Condition,Status,Action,Allowed 3.2.7,amendments,*,,Draft,View,FALSE 3.2.8,amendments,Unicef Focal Point,not_in_amendment_mode,Signed,Edit,TRUE 3.2.9,amendments,Unicef Focal Point,not_in_amendment_mode,Active,Edit,TRUE +3.2.9,amendments,Unicef Focal Point,post_epd_temp_conditions,Ended,Edit,TRUE 3.3.7,attachments,*,not_in_amendment_mode,*,View,TRUE 3.3.7,attachments,Unicef Focal Point,not_in_amendment_mode,Draft,Edit,TRUE 3.3.7,attachments,Partner User,not_in_amendment_mode,Draft,Edit,TRUE diff --git a/src/etools/applications/partners/permissions.py b/src/etools/applications/partners/permissions.py index 8835d004fa..1fd787179f 100644 --- a/src/etools/applications/partners/permissions.py +++ b/src/etools/applications/partners/permissions.py @@ -119,6 +119,19 @@ def __init__(self, **kwargs): def user_added_amendment(instance): return instance.in_amendment is True + # TODO: remove this as sooon as it expires on July first. Technical Debt - hard coded exception + def post_epd_temp_conditions(i): + # quick fix for offices that have not added their amendments in the system before the release date. + today = datetime.date.today() + available_til = datetime.date(2023,7,1) + begin_date = datetime.date(2022,12,1) + release_date = datetime.date(2023,4,1) + if begin_date <= i.end_date < release_date \ + and today < available_til \ + and i.document_type != "SSFA": + return True + return False + def prp_mode_off(): return tenant_switch_is_active("prp_mode_off") @@ -213,6 +226,7 @@ def not_ssfa(instance): 'unlocked_or_spd': not not_spd(self.instance) or unlocked(self.instance), 'unicef_not_accepted_spd_non_hum': unicef_not_accepted_spd_non_hum(self.instance), 'not_ssfa+unicef_not_accepted': not_ssfa(self.instance) and unicef_not_accepted(self.instance), + 'post_epd_temp_conditions': post_epd_temp_conditions(self.instance), } # override get_permissions to enable us to prevent old interventions from being blocked on transitions From 8aa8edbe30fe38c2284c5ad620d68ec43d412996 Mon Sep 17 00:00:00 2001 From: robertavram Date: Mon, 27 Mar 2023 21:37:11 -0400 Subject: [PATCH 3/5] fix date --- src/etools/applications/partners/permissions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/etools/applications/partners/permissions.py b/src/etools/applications/partners/permissions.py index 1fd787179f..50d92e4746 100644 --- a/src/etools/applications/partners/permissions.py +++ b/src/etools/applications/partners/permissions.py @@ -123,9 +123,9 @@ def user_added_amendment(instance): def post_epd_temp_conditions(i): # quick fix for offices that have not added their amendments in the system before the release date. today = datetime.date.today() - available_til = datetime.date(2023,7,1) - begin_date = datetime.date(2022,12,1) - release_date = datetime.date(2023,4,1) + available_til = datetime.date(2023, 7, 1) + begin_date = datetime.date(2022, 12, 1) + release_date = datetime.date(2023, 4, 30) if begin_date <= i.end_date < release_date \ and today < available_til \ and i.document_type != "SSFA": From b22bfd97e2103337c755067c551f092aef9c1880 Mon Sep 17 00:00:00 2001 From: Ema Ciupe Date: Tue, 28 Mar 2023 16:56:07 +0300 Subject: [PATCH 4/5] intervention.end instead of end_date; test fix --- src/etools/applications/partners/permissions.py | 2 +- src/etools/applications/partners/tests/test_models.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/etools/applications/partners/permissions.py b/src/etools/applications/partners/permissions.py index 50d92e4746..ae5212b497 100644 --- a/src/etools/applications/partners/permissions.py +++ b/src/etools/applications/partners/permissions.py @@ -126,7 +126,7 @@ def post_epd_temp_conditions(i): available_til = datetime.date(2023, 7, 1) begin_date = datetime.date(2022, 12, 1) release_date = datetime.date(2023, 4, 30) - if begin_date <= i.end_date < release_date \ + if i.end and begin_date <= i.end < release_date \ and today < available_til \ and i.document_type != "SSFA": return True diff --git a/src/etools/applications/partners/tests/test_models.py b/src/etools/applications/partners/tests/test_models.py index 2d0ec839ef..70a8bc3e66 100644 --- a/src/etools/applications/partners/tests/test_models.py +++ b/src/etools/applications/partners/tests/test_models.py @@ -680,6 +680,7 @@ def test_permission_structure(self): 'true': [ {'status': 'signed', 'group': 'Unicef Focal Point', 'condition': 'not_in_amendment_mode'}, {'status': 'active', 'group': 'Unicef Focal Point', 'condition': 'not_in_amendment_mode'}, + {'status': 'ended', 'group': 'Unicef Focal Point', 'condition': 'post_epd_temp_conditions'} ] } }) From b31b23401318a62577ed060fece83cc7a43b68af Mon Sep 17 00:00:00 2001 From: robertavram Date: Tue, 28 Mar 2023 22:48:25 -0400 Subject: [PATCH 5/5] move closed interventions w amendments to active --- src/etools/applications/partners/models.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/etools/applications/partners/models.py b/src/etools/applications/partners/models.py index 48beaf8b5f..68945e4805 100644 --- a/src/etools/applications/partners/models.py +++ b/src/etools/applications/partners/models.py @@ -2864,6 +2864,11 @@ def merge_amendment(self): self.is_active = False self.save() + # TODO: Technical debt - remove after tempoorary exception for ended amendments is removed. + if self.intervention.status == self.intervention.ENDED: + if self.intervention.end >= datetime.date.today() >= self.intervention.start: + self.intervention.status = self.intervention.ACTIVE + self.intervention.save(amendment_number=self.intervention.amendments.filter(is_active=False).count()) amended_intervention.delete()