3 models
- Person (people table)
- Trail (trails table)
- Practice (practices tables)
Person model
- has age, body-build (slim, fit, large)
- can
start
practice on any trail - given he/she has passed the criteria of a trail
- given he/she is not already starting a practice on a trail
- can
finish
practice on a trail - given he/she is starting this particular trail
- can see all trails finished
- can see all uncompleted trails
Trail model
- has pass criteria depending on age, body-build
- can see people who have finished this trail
- can see people who have started the trail
- can see people who can start the trail
Practice model
- has the status field of person/trail
2 models
- Race (table races)
- Run (table runs)
Race model
- belongs to a Trail
- can
register
People to join - can
start
/end
a race- State is manually changed (new → started, started → finished)
- can't start if less than 2 People registered
- when a Race finishes, assign random duration and status (finished or unfinished) for the racers
- declare the fastest runner as winner
- Can only have 1 winner
Run model
- States: Registered and Dropped (manually changed), Finished and Unfinished (randomly assigned when Race has ended)
Rules
- Trail can have multiple Races but should have different time slots
- Person should have a finished Practice for the Trail before becoming eligible to register for a Race
- Person can only register for a Race once.
- Person cannot register for a Race if there is an ongoing Practice.
- Person cannot also start a Practice if there is an ongoing Race.
- Person cannot register when Race is already starting or finished
- Person can register for another Race:
- For the same Trail (since none of the Races per Trail would overlap)
- For another Trail but should not overlap with currently registered Race
Additional
- Add view on Trail for races list
- Add view on Person for races list
- Add view for Races via navbar
- Don't update Race details if runners have already registered
- User icons created by Freepik - Flaticon
- Road icons created by Smashicons - Flaticon
- Race icons created by Good Ware - Flaticon