소스 검색

分学生加入batchid

liuyu 4 년 전
부모
커밋
c25324571e
1개의 변경된 파일3개의 추가작업 그리고 2개의 파일을 삭제
  1. 3 2
      app/service/class.js

+ 3 - 2
app/service/class.js

@@ -39,7 +39,7 @@ class ClassService extends CrudService {
       // 取出班级人数下的学生id
       const beforestu = _.take(_students, stunum);
       // 将取出的数据调用更新学生的班级信息方法
-      await this.studentup(_class.id, beforestu);
+      await this.studentup(_class.id, _class.batchid, beforestu);
       // 将班级自动分为组
       await this.groupcreate(termid, _class.batchid, _class.id);
       // 取出的学生数据从原数据中删除
@@ -48,12 +48,13 @@ class ClassService extends CrudService {
   }
 
   // 根据传入的学生列表和班级id更新学生信息
-  async studentup(classid, beforestu) {
+  async studentup(classid, batchid, beforestu) {
     // 循环学生id
     for (const stuid of beforestu) {
       const student = await this.stumodel.findById(stuid);
       if (student) {
         student.classid = classid;
+        student.batchid = batchid;
         await student.save();
       }
     }