fw42 / cubecomp

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

Fix autocompletion for competitors with two first or last names #245

Closed Laura-O closed 6 years ago

Laura-O commented 6 years ago

Currently, the autocompletion for competitors who already have a WCA ID just splits the name into an array using whitespace as separator. It then assumes that the first element is the first name and the second element is the last name. So "John Doe Smith" becomes first name: "John", last name: "Doe" and "Smith" is ignored.

This PR fixes this by splitting the string at the first whitespace and making the remaining string the second element in the array. This is still not 100% correct if the competitor has two first names as the second first name and the last name are filled in as the last name. However, I think this is still better than just omitting the last name.

Background: there is a German competitor with two last names who repeatedly registered with only his first last name and I know found out why he does that. ;-)

Laura-O commented 6 years ago

Updated the PR with an easier solution without the regular expression. :smile: