From 261261ebea793bb6d7e5e384917d8f342a4130d2 Mon Sep 17 00:00:00 2001 From: Thor77 Date: Sat, 2 Jul 2022 18:05:06 +0200 Subject: [PATCH] Fix sort matches by position only working in fx by luck --- js/redux/tournamentApi.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/js/redux/tournamentApi.js b/js/redux/tournamentApi.js index 0c792bb..e1b9602 100644 --- a/js/redux/tournamentApi.js +++ b/js/redux/tournamentApi.js @@ -72,7 +72,15 @@ function convertTournament(apiTournament) { function convertPlayoffStage(apiStage) { return { - id: apiStage.id, level: apiStage.level, matches: apiStage.matches.sort((a, b) => a.position > b.position).map(match => convertMatch(match, false)) + id: apiStage.id, level: apiStage.level, matches: apiStage.matches.sort((a, b) => { + if (a.position < b.position) { + return -1 + } else if (a.position > b.position) { + return 1 + } else { + return 0 + } + }).map(match => convertMatch(match, false)) }; }