From dcdd3c353c8e5b13dbee973ad81a6775a6da8e9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Andr=C3=A9?= Date: Sat, 1 May 2021 09:49:28 +0200 Subject: [PATCH] Correctif sur le tri de l'affichage des sauts --- .../src/app/list-of-jumps/list-of-jumps.component.ts | 8 +++++++- .../src/app/new-jump/new-jump.component.html | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Front/skydivelogs-app/src/app/list-of-jumps/list-of-jumps.component.ts b/Front/skydivelogs-app/src/app/list-of-jumps/list-of-jumps.component.ts index 43125af..df674b7 100644 --- a/Front/skydivelogs-app/src/app/list-of-jumps/list-of-jumps.component.ts +++ b/Front/skydivelogs-app/src/app/list-of-jumps/list-of-jumps.component.ts @@ -49,7 +49,13 @@ export class ListOfJumpsComponent implements OnInit { this.listOfJumps = this.serviceApi.GetListOfJumps(); this.listOfJumps.subscribe(data => { setTimeout(() => { - data.sort((a, b) => b.id - a.id); + data.sort((a, b) => { + if (a.jumpDate.getTime() === b.jumpDate.getTime()) { + return b.id > a.id ? 1 : -1; + } + return b.jumpDate > a.jumpDate ? 1 : -1; + }); + this.dataSourceTable = new MatTableDataSource(data); this.dataSourceTable.paginator = this.paginator; this.resultsLength = data.length; diff --git a/Front/skydivelogs-app/src/app/new-jump/new-jump.component.html b/Front/skydivelogs-app/src/app/new-jump/new-jump.component.html index cc9ca06..a9c06ad 100644 --- a/Front/skydivelogs-app/src/app/new-jump/new-jump.component.html +++ b/Front/skydivelogs-app/src/app/new-jump/new-jump.component.html @@ -56,7 +56,7 @@ - {{gear.name}} + {{gear.name}} ({{gear.mainCanopy}})