lrf преди 2 години
родител
ревизия
105cba15db
променени са 1 файла, в които са добавени 2 реда и са изтрити 2 реда
  1. 2 2
      app/service/statistics.js

+ 2 - 2
app/service/statistics.js

@@ -15,12 +15,12 @@ class StatisticsService extends CrudService {
     const resList = [];
     for (const team of teamList) {
       const { team_id } = team;
-      const matchList = await this.ctx.model.Schedule.find({ match_id, $or: [{ red_id: team_id }, { blue_id: team_id }] });
+      const matchList = await this.ctx.model.Schedule.find({ match_id, $or: [{ red_id: team_id }, { blue_id: team_id }], is_bye: false });
       const res = this.computedTeam(matchList, team_id);
       const info = this.getOtherInfoFromList(matchList, team_id);
       resList.push({ ...res, ...info });
     }
-    return resList;
+    return _.orderBy(resList, [ 'win', 'score' ], [ 'desc', 'desc' ]);
   }
 
   async ranking() {