fw42 / cubecomp

WCA Rubik's Cube competition website hosting
https://cubecomp.de/
MIT License
10 stars 4 forks source link

Fix wca handle mapping #223

Closed fw42 closed 8 years ago

fw42 commented 8 years ago

This should fix https://github.com/fw42/cubecomp/issues/222.

We have short handles (2, 3, 4) and wca handles (222, 333, 444) for events. The shorter ones are for printing in the competitors table, just because they look nicer. The longer ones are used for the CSV export. You specify the short handle for your event and the code knows the long handle already (based on this mapping).

Previously, if someone would accidentally (or on purpose) use the original WCA handles as the handle for an event, a few things would break (https://github.com/fw42/cubecomp/issues/222 for example).

This PR (hopefully) fixes that by making the mapping a bit smarter (i.e. if no WCA handle can be found based on the short handle, check if the short handle already is a valid WCA handle).