lrf402788946 пре 4 година
родитељ
комит
60be9a27e3
1 измењених фајлова са 10 додато и 7 уклоњено
  1. 10 7
      app/service/cerconfirm.js

+ 10 - 7
app/service/cerconfirm.js

@@ -48,6 +48,7 @@ class CerconfirmService extends CrudService {
         if (res.length <= 0)list.push(student);
       }
     }
+    console.log(list.length);
     // 计算分数
     list = await this.getScore(list);
     return list;
@@ -60,19 +61,21 @@ class CerconfirmService extends CrudService {
     // 日常分
     let dailyScoreList = await this.ctx.model.Personalscore.find({ classid });
     dailyScoreList = this.ctx.service.student.getDailyScore(dailyScoreList);
-    list = this.ctx.service.student.dealScoreList(dailyScoreList, list, 'daily');
+    if (dailyScoreList.length > 0) { list = this.ctx.service.student.dealScoreList(dailyScoreList, list, 'daily'); }
     // 作业分
     let taskScoreList = await this.ctx.model.Uploadtask.find({ classid });
     taskScoreList = this.ctx.service.student.getTaskScore(taskScoreList);
-    list = this.ctx.service.student.dealScoreList(taskScoreList, list, 'task');
+    if (taskScoreList.length > 0) { list = this.ctx.service.student.dealScoreList(taskScoreList, list, 'task'); }
     // 团队分
     const groupList = await this.ctx.model.Group.find({ classid });
     const groupScoreList = await this.ctx.model.Groupscore.find({ classid });
-    list = this.ctx.service.student.dealGroupScoreList(
-      groupList,
-      groupScoreList,
-      list
-    );
+    if (groupScoreList.length > 0) {
+      list = this.ctx.service.student.dealGroupScoreList(
+        groupList,
+        groupScoreList,
+        list
+      );
+    }
     list = _.orderBy(list, [ 'is_fine' ], [ 'desc' ]);
     return list;
   }