parent
dd48ee2f7e
commit
d7791756dc
@ -69,7 +69,7 @@ export class StatsController {
|
|||||||
@ResponseSchema(ResponseStatsTeam, { isArray: true })
|
@ResponseSchema(ResponseStatsTeam, { isArray: true })
|
||||||
@OpenAPI({ description: "Returns the top ten teams by distance.", security: [{ "StatsApiToken": [] }] })
|
@OpenAPI({ description: "Returns the top ten teams by distance.", security: [{ "StatsApiToken": [] }] })
|
||||||
async getTopTeamsByDistance() {
|
async getTopTeamsByDistance() {
|
||||||
let teams = await getConnection().getRepository(RunnerTeam).find({ relations: ["runners", "runners.scans"] });
|
let teams = await getConnection().getRepository(RunnerTeam).find({ relations: ['runners', 'runners.scans', 'runners.distanceDonations'] });
|
||||||
let topTeams = teams.sort((team1, team2) => team1.distance - team2.distance).slice(0, 9);
|
let topTeams = teams.sort((team1, team2) => team1.distance - team2.distance).slice(0, 9);
|
||||||
let responseTeams: ResponseStatsTeam[] = new Array<ResponseStatsTeam>();
|
let responseTeams: ResponseStatsTeam[] = new Array<ResponseStatsTeam>();
|
||||||
topTeams.forEach(team => {
|
topTeams.forEach(team => {
|
||||||
@ -83,7 +83,7 @@ export class StatsController {
|
|||||||
@ResponseSchema(ResponseStatsTeam, { isArray: true })
|
@ResponseSchema(ResponseStatsTeam, { isArray: true })
|
||||||
@OpenAPI({ description: "Returns the top ten teams by donations.", security: [{ "StatsApiToken": [] }] })
|
@OpenAPI({ description: "Returns the top ten teams by donations.", security: [{ "StatsApiToken": [] }] })
|
||||||
async getTopTeamsByDonations() {
|
async getTopTeamsByDonations() {
|
||||||
let teams = await getConnection().getRepository(RunnerTeam).find({ relations: ["runners", "runners.scans", "runners.distanceDonations"] });
|
let teams = await getConnection().getRepository(RunnerTeam).find({ relations: ['runners', 'runners.scans', 'runners.distanceDonations'] });
|
||||||
let topTeams = teams.sort((team1, team2) => team1.distanceDonationAmount - team2.distanceDonationAmount).slice(0, 9);
|
let topTeams = teams.sort((team1, team2) => team1.distanceDonationAmount - team2.distanceDonationAmount).slice(0, 9);
|
||||||
let responseTeams: ResponseStatsTeam[] = new Array<ResponseStatsTeam>();
|
let responseTeams: ResponseStatsTeam[] = new Array<ResponseStatsTeam>();
|
||||||
topTeams.forEach(team => {
|
topTeams.forEach(team => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user