|
@@ -44,7 +44,7 @@ class ClassService extends CrudService {
|
|
|
// 取出班级人数下的学生id
|
|
|
const beforestu = _.take(_students, stunum);
|
|
|
// 将取出的数据调用更新学生的班级信息方法
|
|
|
- await this.studentup(_class.id, _class.batchid, beforestu);
|
|
|
+ await this.studentup(_class.id, _class.type, _class.batchid, beforestu);
|
|
|
// 将班级自动分为组
|
|
|
await this.groupcreate(termid, _class.batchid, _class.id);
|
|
|
// 取出的学生数据从原数据中删除
|
|
@@ -74,14 +74,16 @@ class ClassService extends CrudService {
|
|
|
}
|
|
|
|
|
|
// 根据传入的学生列表和班级id更新学生信息
|
|
|
- async studentup(classid, batchid, beforestu) {
|
|
|
+ async studentup(classid, type, 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();
|
|
|
+ if (type === student.type) {
|
|
|
+ student.classid = classid;
|
|
|
+ student.batchid = batchid;
|
|
|
+ await student.save();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|