From 79e8dcfdd0b0ac2a13e3c826d8e683d3279e1ef5 Mon Sep 17 00:00:00 2001 From: L4168 <L4168@student.jamk.fi> Date: Tue, 2 Jul 2019 08:06:20 +0300 Subject: [PATCH] returnGameInfo sorts factions by name --- src/game/game.service.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/game/game.service.ts b/src/game/game.service.ts index 1bad6ae..9a74a46 100644 --- a/src/game/game.service.ts +++ b/src/game/game.service.ts @@ -132,6 +132,10 @@ export class GameService { where: { id: id }, relations: ['factions', 'objective_points'], }); + // sort factions by their name + game.factions.sort(function(a, b) { + return a['factionName'].localeCompare(b['factionName']); + }); return game; } -- GitLab