guhongwei преди 2 години
родител
ревизия
d222c82629
променени са 1 файла, в които са добавени 3 реда и са изтрити 2 реда
  1. 3 2
      app/service/schedule.js

+ 3 - 2
app/service/schedule.js

@@ -29,7 +29,7 @@ class ScheduleService extends CrudService {
 
   async checkNeedNext(id) {
     const sch = await this.model.findById(id);
-    const { red_branch, blue_branch, match_id, status } = sch;
+    const { red_branch, blue_branch, match_id, match_name, status } = sch;
     // 手动确定比赛结束,如果比赛不结束,那就不需要下面
     if (status !== '2') return;
     if (!red_branch || !blue_branch) return;
@@ -46,7 +46,7 @@ class ScheduleService extends CrudService {
     const mpl = match_position.split('-');
     const head = _.head(mpl);
     const mpReg = new RegExp(`${head}-`);
-    const condition = { match_id, match_position: mpReg, is_bye: true };
+    const condition = { match_id, match_name, match_position: mpReg, is_bye: true };
     const has_bye = await this.model.count(condition);
     // 说明有轮空,让管理员去创建下一轮的所有比赛赛程
     if (has_bye > 1) return;
@@ -71,6 +71,7 @@ class ScheduleService extends CrudService {
     // 先查询有没有  match_name: '晋级赛',
     let nextMatchCreateData = {
       match_id,
+      match_name,
       match_position: next_match_position,
     };
     let nextMatch = await this.model.findOne(nextMatchCreateData);