Skip to content

Commit

Permalink
Implement __getAssignedTo in Item class
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Campbell committed Jul 26, 2020
1 parent 8dd6d34 commit 72e4f7a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions api/ECNQueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def __init__(self, queue: str, number: int) -> None:
self.userEmail = self.__getUserEmail()
self.userName = self.__getUserName()
self.userAlias = self.__getUserAlias()
self.assignedTo = self.__getAssignedTo()

def __getLastUpdated(self) -> float:
"""Returns last modified time of item reported by the filesystem in mm-dd-yy hh:mm am/pm format.
Expand Down Expand Up @@ -216,6 +217,16 @@ def __getUserAlias(self) -> Union[str, None]:
emailUser, emailDomain = self.userEmail.split("@")
return emailUser if emailDomain.endswith("purdue.edu") else None

def __getAssignedTo(self) -> Union[str, None]:
"""Returns the alias of the person this item was most recently assigned to.
Returns None if this item isn't assigned.
Returns:
Union[str, None]: Alias of the person item is assigned to or None
"""
assignedToHeader = self.__getMostRecentHeaderByType("Assigned-To")
return assignedToHeader["content"] if assignedToHeader != None else None

def __repr__(self) -> str:
return self.queue + str(self.number)

Expand Down

0 comments on commit 72e4f7a

Please sign in to comment.