lrf 2 rokov pred
rodič
commit
82501d607f
1 zmenil súbory, kde vykonal 5 pridanie a 3 odobranie
  1. 5 3
      app/service/schedule.js

+ 5 - 3
app/service/schedule.js

@@ -29,12 +29,14 @@ class ScheduleService extends CrudService {
 
   async checkNeedNext(id) {
     const sch = await this.model.findById(id);
-    const { red_branch, blue_branch, match_id } = sch;
+    const { red_branch, blue_branch, match_id, status } = sch;
+    // 手动确定比赛结束,如果比赛不结束,那就不需要下面
+    if (status !== '2') return;
     if (!red_branch || !blue_branch) return;
     // 有比分,有位置, 再看看同一轮其他比赛是不是有轮空的.有轮空的就不安排,没有轮空的就直接安排晋级比赛
     // 将胜利的队伍的属性取出来,以便下面生成新数据
     const winProp = [];
-    const propList = ['id', 'name', 'logo', 'members'];
+    const propList = [ 'id', 'name', 'logo', 'members' ];
     const winTeam = this.getWinTeam(sch);
     for (const p of propList) {
       winProp.push({ key: p, value: sch[`${winTeam}_${p}`] });
@@ -85,7 +87,7 @@ class ScheduleService extends CrudService {
       // 修改,一定是将数据放入蓝队中,所以需要判断下蓝队和红队是不是一个队伍,看下id就行
       const nmRed_id = _.get(nextMatch, 'red_id');
       const winTeamId = _.get(
-        winProp.find((f) => f.key === 'id'),
+        winProp.find(f => f.key === 'id'),
         'value'
       );
       if (nmRed_id === winTeamId) return;