modified ranking
This commit is contained in:
@@ -358,7 +358,6 @@ export class EquipoController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Get('ranking/:year')
|
||||
async ranking(@Param('year') year: string) {
|
||||
return this.equipoService.ranking(Number(year));
|
||||
|
||||
@@ -1088,14 +1088,14 @@ export class EquipoService {
|
||||
for (const equipo of equipos) {
|
||||
if (!equipo.mov || equipo.mov.length === 0) continue;
|
||||
|
||||
const movimientosDelAnno = equipo.mov.filter((mov) => {
|
||||
const equipoyear = equipo.mov.filter((mov) => {
|
||||
const fecha = new Date(mov.fechaMovimiento);
|
||||
return fecha.getFullYear() === year;
|
||||
});
|
||||
|
||||
if (movimientosDelAnno.length === 0) continue;
|
||||
if (equipoyear.length === 0) continue;
|
||||
|
||||
const ultimoMov = movimientosDelAnno.sort(
|
||||
const ultimoMov = equipoyear.sort(
|
||||
(a, b) =>
|
||||
new Date(b.fechaMovimiento).getTime() -
|
||||
new Date(a.fechaMovimiento).getTime(),
|
||||
|
||||
Reference in New Issue
Block a user