From 155e6f49af269d0412c3e47bfffc2d8d5d41fe0d Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Tue, 23 May 2023 17:20:28 +0900 Subject: [PATCH] Reverse history order --- back/src/history/history.service.ts | 6 +++--- back/test/robot/history/history.robot | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/back/src/history/history.service.ts b/back/src/history/history.service.ts index 38c481b..dbd68c5 100644 --- a/back/src/history/history.service.ts +++ b/back/src/history/history.service.ts @@ -46,7 +46,7 @@ export class HistoryService { ): Promise { return this.prisma.songHistory.findMany({ where: { user: { id: playerId } }, - orderBy: { playDate: 'asc' }, + orderBy: { playDate: 'desc' }, skip, take, }); @@ -61,7 +61,7 @@ export class HistoryService { }): Promise<{ best: number; history: SongHistory[] }> { const history = await this.prisma.songHistory.findMany({ where: { user: { id: playerId }, song: { id: songId } }, - orderBy: { playDate: 'asc' }, + orderBy: { playDate: 'desc' }, }); return { @@ -94,7 +94,7 @@ export class HistoryService { ): Promise { return this.prisma.searchHistory.findMany({ where: { user: { id: playerId } }, - orderBy: { searchDate: 'asc' }, + orderBy: { searchDate: 'desc' }, skip, take, }); diff --git a/back/test/robot/history/history.robot b/back/test/robot/history/history.robot index f092301..ee3042d 100644 --- a/back/test/robot/history/history.robot +++ b/back/test/robot/history/history.robot @@ -102,7 +102,7 @@ Get the history of a single song Output &{song2}= POST ... /song - ... {"name": "Mama mia", "difficulties": {}, "midiPath": "/musics/Beethoven-125-4.midi", "musicXmlPath": "/musics/Beethoven-125-4.mxl"} + ... {"name": "Mama mia2", "difficulties": {}, "midiPath": "/musics/Beethoven-125-42.midi", "musicXmlPath": "/musics/Beethoven-125-24.mxl"} Output ${userID}= RegisterLogin wowuser @@ -126,13 +126,13 @@ Get the history of a single song Output Integer response status 200 Array response body history - Integer $history[0].userID ${userID} - Integer $history[0].songID ${song.body.id} - Integer $history[0].score 65 - Integer $history[1].userID ${userID} - Integer $history[1].songID ${song.body.id} - Integer $history[1].score 55 - Integer $best 65 + Integer $.history[0].userID ${userID} + Integer $.history[0].songID ${song.body.id} + Integer $.history[0].score 65 + Integer $.history[1].userID ${userID} + Integer $.history[1].songID ${song.body.id} + Integer $.history[1].score 55 + Integer $.best 65 [Teardown] Run Keywords DELETE /users/${userID} ... AND DELETE /song/${song.body.id}