Skip to content

Commit

Permalink
Adjust calculating Acknowledgement Due Date
Browse files Browse the repository at this point in the history
  • Loading branch information
estevez90 committed Mar 14, 2016
1 parent bd06376 commit d84d26c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions public_records_portal/db_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)))
Expand Down
6 changes: 3 additions & 3 deletions public_records_portal/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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']),
Expand Down

0 comments on commit d84d26c

Please sign in to comment.