AthleteSeedSerializer: Contains two fields, athlete of type PrimaryKeyRelatedField and seed_time of type HeatDurationField.
GenerateHeatSerializer: Introduces a unique field athletes of type AthleteSeedSerializer, expecting multiple records.
This serializer has two functions:
create: Accepts a list of athletes, sorts them by seed time, and generates corresponding heats.
calculate_lane_num: An auxiliary function to calculate the lane number of an athlete.
backend/api/views/GenerateHeatView.py
This view utilizes GenerateHeatSerializer and comprises three functions:
get_queryset: Accepts a group_id and filters all athletes corresponding to that group.
post: Receives an event_id along with a list of athletes and their seed times, then creates heats corresponding to that event.
delete: Given an event_id, removes all heats related to that event.
backend/api/urls.py
Introduced the event_heat// endpoint that utilizes GenerateHeatView.
This PR address issue #57
Implementation
Added two serializers:
AthleteSeedSerializer
: Contains two fields, athlete of typePrimaryKeyRelatedField
and seed_time of typeHeatDurationField
.GenerateHeatSerializer
: Introduces a unique field athletes of typeAthleteSeedSerializer
, expecting multiple records. This serializer has two functions:create
: Accepts a list of athletes, sorts them by seed time, and generates corresponding heats.calculate_lane_num
: An auxiliary function to calculate the lane number of an athlete.GenerateHeatSerializer
and comprises three functions:get_queryset
: Accepts a group_id and filters all athletes corresponding to that group.post
: Receives an event_id along with a list of athletes and their seed times, then creates heats corresponding to that event.delete
: Given anevent_id
, removes all heats related to that event.Introduced the event_heat// endpoint that utilizes GenerateHeatView.