Commit 7e9913c0 authored by nanahira's avatar nanahira

Update src/tournament/tournament.service.ts, src/tournament/entities/Tournament.entity.ts files

parent 3816f8f0
Pipeline #38207 passed with stages
in 3 minutes and 14 seconds
......@@ -282,4 +282,19 @@ export class Tournament extends DescBase {
// this.calculateTree();
}
}
async afterGet() {
this.participants?.sort((a, b) => {
if (a.seq !== b.seq) return a.seq - b.seq;
return a.id - b.id;
});
this.matches?.sort((a, b) => {
if (a.round !== b.round) return a.round - b.round;
if (a.isThirdPlaceMatch !== b.isThirdPlaceMatch) {
return (a.isThirdPlaceMatch ? 1 : 0) - (b.isThirdPlaceMatch ? 1 : 0);
}
return a.id - b.id;
});
}
}
......@@ -39,12 +39,12 @@ export class TournamentService extends CrudService(Tournament, {
'matches.winner',
],
extraGetQuery: (qb) => {
qb
/*qb
.addOrderBy('participants.seq', 'ASC')
.addOrderBy('participants.id', 'ASC')
.addOrderBy('matches.round', 'ASC')
.addOrderBy('matches.isThirdPlaceMatch', 'ASC')
.addOrderBy('matches.id', 'ASC');
.addOrderBy('matches.id', 'ASC');*/
// qb.expressionMap.relationLoadStrategy = 'query';
return qb;
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment