makes majority of the entrylist fields optional #278
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR note: happy to approach this in a different way, as far as I could tell this was the only way. Can't seem to add defaults to JSON structs and doing any default in the frontend would only solve this for the frontend and not the API. In the end omitting was likely better as it keeps the entrylist as-is (from simgrid etc) and rely on the ACC defaults itself.
commit msg:
valid entrylist entries can be quite small, e.g.
the above valid entrylist entry is from a simgrid entrylist where all admins are added to the entrylist even though they've not signed up for the race.
currently if these entrylists were imported as-is either via the GUI or API the result would end up as:
The main obvious problem here is '0' for the ForcedCarModel is a porsche car, whilst in reality the entrylist from simgrid isn't forcing a car model, similar issues exist for some of the other settings which are not defaulting to
-1
and instead defaulting to0
.The ideal scenario is for the entrylist to be exactly the same once imported via accweb, however due to the checkboxes this is not really possible (checkboxes are either unchecked or checked via the GUI).
You could import via the API and get:
However if you import via the GUI you will get:
To be consistent I've instead opted to not set
omitempty
onOverrideDriverInfo
andOverrideCarModelForCustomCar
which will keep the API and GUI consistent with each other to make future debugging/understanding easier. I don't foresee any issues with importing a simgrid entrylist and havingoverrideDriverInfo
andoverrideCarModelForCustomCar
added by accweb unless ACC defaults in the future changes (very unlikely).