Skip to content

Commit

Permalink
Merge branch 'enhancement-date-parsing-for-header' of github.itap.pur…
Browse files Browse the repository at this point in the history
…due.edu:ECN/webqueue2 into enhancement-date-parsing-for-header
  • Loading branch information
Jacob Daniel Bennett committed Sep 10, 2020
2 parents e452fb0 + b522fe4 commit 7652331
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions api/ECNQueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def __init__(self, queue: str, number: int) -> None:
self.priority = self.__getMostRecentHeaderByType("Priority")
self.department = self.__getMostRecentHeaderByType("Department")
self.building = self.__getMostRecentHeaderByType("Building")
self.dateReceived = self.__getMostRecentHeaderByType("Date")
self.dateReceived = self.__getParsedDate(self.__getMostRecentHeaderByType("Date"))

self.jsonData = {
"queue": self.queue,
Expand Down Expand Up @@ -274,13 +274,13 @@ def __getFormattedDate(self, date: str) -> str:
str: Properly formatted date/time recieved or empty string.
"""
try:
objDateRecieved = parse(date)
parsedDate = parse(date)
except:
return ""

formattedDateRecieved = objDateRecieved.strftime("%Y-%m-%dT%H:%M:%S%z")
parsedDateString = parsedDate.strftime("%Y-%m-%dT%H:%M:%S%z")

return formattedDateRecieved
return parsedDateString

def toJson(self) -> dict:
"""Returns a JSON safe representation of the item.
Expand Down Expand Up @@ -362,4 +362,4 @@ def getQueues() -> list:
if isDirectory and isValid:
queues.append(Queue(file))

return queues
return queues

0 comments on commit 7652331

Please sign in to comment.