Hi all,
Im building a little app for my wife who is having an F1 watch party whereby everyone who attends can add their race predictions in from 1st-10th.
Each position they get correct they should receive the certain amount of points relative to that position, but I cant seem to make this work.
As a test, i have entered my predictions and some fake race results.
The problem is even if a driver is selected but doesnt finish in the same position as my prediction, i still get points for it.
eg I Selected Alexander Albon to finish 2nd, but he finished Last, yet i still get 5 points when i get 0 as my prediction was wrong.
Add another Lookup column in the Prediction table, that looks up the Row ID column of the Race Results. Call it ID for reference:
Change the If → Then → Else to “IF ID = [MANUAL], THEN 1st_LOOK, ELSE 0”
Where [MANUAL] is the Row ID that corresponds to that position. For example, the 1st_IF value for [MANUAL] should be the ROW ID of “1st Position” in the Race Results table.
Races: Add a table for Races, with RowID, Race Names.
Predictions: Add a column for RaceID (RowID) coming from Races, I assume people will be able to predict 1st, 2nd, 3rd etc. Craft a JSON column to have a centralized “string” for all predictions from a player.
E.g:
{
"1st": "John Doe",
"2nd": "James Doe"
}
Race Results: Add a column for RaceID, and then a JSON like this.
In Predictions, use a multiple relation with the RaceID to the Race Resuls table, then a Joined List column to get all the templates back, separate by a comma and a new line character.
Add a template column with the template being:
[
R
]
With R being the Joined List above (formatted to true JSON).
Then, with a JSON for the player’s prediction, and a JSON array for the race results, you would use JavaScript to get the final points.