From: Daniel Karbach Date: Wed, 30 Mar 2022 09:39:44 +0000 (+0200) Subject: prefer nickname sorting participants X-Git-Url: http://git.localhorst.tv/?a=commitdiff_plain;h=9bc03c27b90df8f8acfdecc5cfbcbf8226485abc;p=alttp.git prefer nickname sorting participants --- diff --git a/resources/js/helpers/Participant.js b/resources/js/helpers/Participant.js index 7a68996..d7bdd7c 100644 --- a/resources/js/helpers/Participant.js +++ b/resources/js/helpers/Participant.js @@ -1,3 +1,5 @@ +import User from './User'; + export const compareFinished = round => (a, b) => { const a_result = findResult(a, round); const b_result = findResult(b, round); @@ -41,8 +43,8 @@ export const compareResult = round => (a, b) => { }; export const compareUsername = (a, b) => { - const a_name = a && a.user && a.user.username ? a.user.username : ''; - const b_name = b && b.user && b.user.username ? b.user.username : ''; + const a_name = a && a.user ? User.getUserName(a.user) : ''; + const b_name = b && b.user ? User.getUserName(b.user) : ''; return a_name.localeCompare(b_name); }; diff --git a/resources/js/helpers/User.js b/resources/js/helpers/User.js index 222e0f6..f13e119 100644 --- a/resources/js/helpers/User.js +++ b/resources/js/helpers/User.js @@ -18,5 +18,6 @@ export const hasFinishedRound = (user, round) => { export default { findResult, getAvatarUrl, + getUserName, hasFinishedRound, };