Hi, I’m using your add-on to sort the results according to the points scored by the user. I have changed the code a little bit in order to show also users who have not entered typing.
But is it possible to make the sorting work like this, for example. 1. Users who have scored 3 points 2. Users who have scored 2 points 3. Users who have scored 1 points 4. Users who have scored 0 points 5. Users who have scored 0 points (but did not type).
That is, from the highest number of points scored to the lowest, but so that those who did not type at all – are at the bottom of the list.
Yes, that is actually pretty easy. I can show you an example tonight. Basically boils down to adding an extra value to the $predictions array (e.g. 1 for the people with a prediction and 0 for those who didn’t). The logic for this is already in that add-on (as part of the remove inactive users). And with this value added to the array, you can use it in the sorting callback as a second sorting parameter for the spaceship operator (meaning when points are the same, then use this new value first to divide the players).
Don’t know. Could be a difference in the user name that is used in the sorting and the user name that is passed to the template for the display. Or something in the spaceship operator with regards to string comparisons. Don’t know if it is worth the effort of investigating.