|
@@ -15,6 +15,7 @@ class LessonService extends CrudService {
|
|
|
this.tmodel = this.ctx.model.Trainplan;
|
|
|
this.clamodel = this.ctx.model.Class;
|
|
|
this.lmodel = this.ctx.model.Lessonmode;
|
|
|
+ this.teamodel = this.ctx.model.Teacher;
|
|
|
}
|
|
|
|
|
|
// 自动排课私有方法
|
|
@@ -72,6 +73,7 @@ class LessonService extends CrudService {
|
|
|
if (i === 6) {
|
|
|
allday = _lessonmode.allday;
|
|
|
}
|
|
|
+
|
|
|
const data = {
|
|
|
subid: _subid,
|
|
|
subname: lessm['day' + i],
|
|
@@ -79,6 +81,12 @@ class LessonService extends CrudService {
|
|
|
time: lessm.time,
|
|
|
day: allday,
|
|
|
};
|
|
|
+ // 将教师按照分数的综合成绩排序,上报时间,安排教师.
|
|
|
+ const teacher_ = await this.autoteacher(_subid);
|
|
|
+ if (teacher_) {
|
|
|
+ data.teaid = teacher_.id;
|
|
|
+ data.teaname = teacher_.name;
|
|
|
+ }
|
|
|
newlesson.push(data);
|
|
|
}
|
|
|
}
|
|
@@ -97,6 +105,17 @@ class LessonService extends CrudService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 自动排教师,按照分数的综合成绩排序,上报时间,安排教师
|
|
|
+ async autoteacher(subid) {
|
|
|
+ // 按照上报时间取得所有老师,进行正序排列
|
|
|
+ const teachers = await this.teamodel.find({ subid, status: '4' }).sort({ zlscore: '-1', msscore: '-1', xsscore: '-1' });
|
|
|
+ let teacher = {};
|
|
|
+ if (teachers.length > 0) {
|
|
|
+ teacher = teachers[0];
|
|
|
+ }
|
|
|
+ return teacher;
|
|
|
+ }
|
|
|
+
|
|
|
// 取得日期间所有日期
|
|
|
async getAllDays(begin_date, end_date) {
|
|
|
const errArr = [],
|