Skip to content

Commit

Permalink
Merge pull request #55 from CityOfNewYork/hotfix/OP-536
Browse files Browse the repository at this point in the history
hotfix/OP-536
  • Loading branch information
joelbcastillo committed Mar 14, 2016
2 parents bd06376 + 6d8fb44 commit 8b4bd76
Show file tree
Hide file tree
Showing 2 changed files with 9 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
10 changes: 7 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,13 @@ 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']))
if self.date_received.hour > 17:
self.due_date = cal.addbusdays(self.due_date, 1)
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']))
if self.date_received.hour > 17:
self.due_date = cal.addbusdays(self.due_date, 1)


def extension(self, days_after=int(app.config['DAYS_AFTER_EXTENSION']),
Expand Down

0 comments on commit 8b4bd76

Please sign in to comment.