mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-19 05:58:53 -04:00
Return delivery estimate for letter notifications
> For get all or get one letter the response needs to be updated so that > it looks similar to admin app. > > status: created|sending --> received letter > new column: `estimated delivery date`: derived from created at date. > (see how the admin app is doing it) > > NOTE: > At the moment we only have 2 statuses for a letter created and > sending, but we will want to have other internal statuses that make > sense to the Notify team but not our services. When we know those > statuses the status map will be updated at that point. – https://www.pivotaltracker.com/story/show/150512525 This commit implements the date (not status) part of this story.
This commit is contained in:
@@ -16,6 +16,7 @@ from notifications_utils.recipients import (
|
||||
InvalidPhoneError,
|
||||
InvalidEmailError
|
||||
)
|
||||
from notifications_utils.letter_timings import get_letter_timings
|
||||
|
||||
from app.encryption import (
|
||||
hashpw,
|
||||
@@ -1029,6 +1030,10 @@ class Notification(db.Model):
|
||||
serialized['line_5'] = self.personalisation.get('address_line_5')
|
||||
serialized['line_6'] = self.personalisation.get('address_line_6')
|
||||
serialized['postcode'] = self.personalisation['postcode']
|
||||
serialized['estimated_delivery'] = \
|
||||
get_letter_timings(serialized['created_at'])\
|
||||
.earliest_delivery\
|
||||
.strftime(DATETIME_FORMAT)
|
||||
|
||||
return serialized
|
||||
|
||||
|
||||
Reference in New Issue
Block a user