From 4aa3f65452b0a6e8cfbd0b2ce1820f771e760131 Mon Sep 17 00:00:00 2001 From: Thor77 Date: Fri, 8 Nov 2019 23:18:17 +0100 Subject: [PATCH] Sort playoff and group matches by position --- js/redux/tournamentApi.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/redux/tournamentApi.js b/js/redux/tournamentApi.js index ddb883a..c2478af 100644 --- a/js/redux/tournamentApi.js +++ b/js/redux/tournamentApi.js @@ -72,7 +72,7 @@ function convertTournament(apiTournament) { function convertPlayoffStage(apiStage) { return { - id: apiStage.id, level: apiStage.level, matches: apiStage.matches.map(match => convertMatch(match, false)) + id: apiStage.id, level: apiStage.level, matches: apiStage.matches.sort((a, b) => a.position > b.position).map(match => convertMatch(match, false)) }; } @@ -81,7 +81,7 @@ function convertGroup(apiGroup) { id: apiGroup.id, number: apiGroup.number, scores: apiGroup.group_scores, - matches: apiGroup.matches.map(match => convertMatch(match, true)) + matches: apiGroup.matches.sort((a, b) => a.position > b.position).map(match => convertMatch(match, true)) }; }