Skip to content

Commit

Permalink
add assignment parsing to item.py
Browse files Browse the repository at this point in the history
  • Loading branch information
benne238 committed Jun 29, 2021
1 parent de2dd76 commit 4dfb974
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/webqueue2api/parser/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ def __parse_sections(self) -> list:
if section["type"] == "initial_message":
body_sections[index] = self.__add_initial_message_headers(section)
break

# Add assignment sections to all the other sections
body_sections.extend(self.__get_assignments())

body_sections = self.__get_sorted_sections(body_sections)

Expand Down Expand Up @@ -302,6 +305,22 @@ def __get_sorted_sections(self, sectionsList: list) -> list:

return sortedSections

def __get_assignments(self) -> list:
assignment_list = []

for index, header in enumerate(self.headers):
if header["type"] == "Assigned-To":
assignment = {
"type": "assignment",
"to": self.headers[index]["content"],
"datetime": self.headers[index + 1]["content"],
"by": self.headers[index + 2]["content"]

}
assignment_list.append(assignment)

return assignment_list

def __check_is_locked(self) -> Union[str, bool]:
"""Returns a string info about the lock if true and a bool False if false
Expand Down

0 comments on commit 4dfb974

Please sign in to comment.