I’m trying to come up with a model layout for a simple enough race
prediction app but am a little stuck. Basically, the app will allow
users to enter their predictions for a number of races (20 races in
total). When the races have been finished, I want to determine who
predicted all of the race winners correctly, who got 19/20, who got
Here’s a summary of the players and their relationships:
A User has one Betslip.
A Betslip has many Predictions (one Prediction for each of the 20
Each Prediction consists of one Race and one Racer (the predicted-to-win
Each Race has a number of Racers.
Each Race has one Winner (also a Racer).
This is where I’m getting a little confused.
Each Prediction consists of one Race and one Racer, but a Race also
consists of a number of Racers. A Race will also have one Winner (also a
Racer). It seems like there are three types of Racers - a general racer
(linked to a race), a predicted-to-win racer (linked to a prediction)
and a winning racer (linked to a race).
Would anyone have any advice on the best way to model this?
At the end of all of the races, the main thing I want to do is compare
each user’s betslip against the actual winners to see how many of their
predictions were correct.