Skip to content

Commit

Permalink
IOFv3: Read start time allocation request
Browse files Browse the repository at this point in the history
  • Loading branch information
bodograumann committed Dec 28, 2023
1 parent 14f2117 commit 604fb7a
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions holper/iofxml3.py
Expand Up @@ -235,8 +235,10 @@ def _read_team_entry(self, element):
entry.competitors.append(competitor)
elif self.tag(child, "Class"):
entry.category_requests.append(model.EntryCategoryRequest(event_category=self._read_class(child)))
elif self.tag(child, "StartTimeAllocationRequest"):
entry.start_time_allocation_requests.append(self._read_start_time_allocation_request(child))
elif not self.tag(child, "Id"):
# Race, AssignedFee, ServiceRequest, StartTimeAllocationRequest, ContactInformation
# Race, AssignedFee, ServiceRequest, ContactInformation
_logger.warning("Skipping unimplemented tag <%s>", child.tag)

return entry
Expand Down Expand Up @@ -277,8 +279,10 @@ def _read_person_entry(self, element):
competitor.control_cards.append(self._read_control_card(child))
elif self.tag(child, "Class"):
entry.category_requests.append(model.EntryCategoryRequest(event_category=self._read_class(child)))
elif self.tag(child, "StartTimeAllocationRequest"):
entry.start_time_allocation_requests.append(self._read_start_time_allocation_request(child))
elif not self.tag(child, "Id"):
# Score, RaceNumber, AssignedFee, ServiceRequest, StartTimeAllocationRequest
# Score, RaceNumber, AssignedFee, ServiceRequest
_logger.warning("Skipping unimplemented tag <%s>", child.tag)

return entry
Expand Down Expand Up @@ -378,6 +382,17 @@ def _read_class(self, element):

return event_category

def _read_start_time_allocation_request(self, element):
request = model.StartTimeAllocationRequest(type=model.StartTimeAllocationRequestType(camelcase_to_snakecase(element.get("type"))))

for child in element:
if self.tag(child, "Person"):
request.person = self._read_person(child)
elif self.tag(child, "Organisation"):
request.organisation = self._read_organisation(child)

return request

def _read_race_course_data(self, element):
race = model.Race()
if element.get("raceNumber"):
Expand Down

0 comments on commit 604fb7a

Please sign in to comment.