From d84d26c8569ffb39da53d1b1564b34c4f6f1bef8 Mon Sep 17 00:00:00 2001 From: estevez90 Date: Mon, 14 Mar 2016 14:39:16 -0400 Subject: [PATCH] Adjust calculating Acknowledgement Due Date --- public_records_portal/db_helpers.py | 2 ++ public_records_portal/models.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/public_records_portal/db_helpers.py b/public_records_portal/db_helpers.py index b849297c7..a2362e4e5 100644 --- a/public_records_portal/db_helpers.py +++ b/public_records_portal/db_helpers.py @@ -13,6 +13,7 @@ from models import * from public_records_portal import cal, app +from business_calendar import Calendar, MO, TU, WE, TH, FR, FOLLOWING try: import ldap @@ -495,6 +496,7 @@ def change_request_status(request_id, status): (request_id, status)) date_created = req.date_received or req.date_created + date_created = cal.adjust(date_created, FOLLOWING) if "days" in status: days_to_fulfill = re.findall(r"(\d{2}) days",status)[0] app.logger.info("Changing Due Date: %s " % cal.addbusdays(date_created, int(days_to_fulfill))) diff --git a/public_records_portal/models.py b/public_records_portal/models.py index 8fbce407f..c712f7a85 100644 --- a/public_records_portal/models.py +++ b/public_records_portal/models.py @@ -22,7 +22,7 @@ check_password_hash from public_records_portal import db, app, cal - +from business_calendar import Calendar, MO, TU, WE, TH, FR, FOLLOWING class notePrivacy: PUBLIC = 0x01 @@ -339,9 +339,9 @@ def set_due_date(self): if not self.date_received: self.date_received = self.date_created if self.extended == True: - self.due_date = cal.addbusdays(self.date_received, int(app.config['DAYS_AFTER_EXTENSION'])) + self.due_date = cal.addbusdays(cal.adjust(self.date_received, FOLLOWING), int(app.config['DAYS_AFTER_EXTENSION'])) else: - self.due_date = cal.addbusdays(self.date_received, int(app.config['DAYS_TO_FULFILL'])) + self.due_date = cal.addbusdays(cal.adjust(self.date_received, FOLLOWING), int(app.config['DAYS_TO_FULFILL'])) def extension(self, days_after=int(app.config['DAYS_AFTER_EXTENSION']),