|
@@ -139,18 +139,25 @@ class ClassService extends CrudService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- async searchDate({ classid }) {
|
|
|
- const classInfo = await this.model.findById(classid);
|
|
|
+ async fetch({ id }) {
|
|
|
+ const classInfo = await this.model.findById(id);
|
|
|
const trainplan = await this.tmodel.findById(classInfo.planid);
|
|
|
if (trainplan) {
|
|
|
const term = _.filter(trainplan.termnum, item => item.id === classInfo.termid);
|
|
|
if (term.length > 0) {
|
|
|
+ classInfo.term = term[0].term;
|
|
|
+ console.log(classInfo.term);
|
|
|
const batch = _.filter(term[0].batchnum, item => item.id === classInfo.batchid);
|
|
|
if (batch.length > 0) {
|
|
|
- return { startdate: batch[0].startdate, enddate: batch[0].enddate };
|
|
|
+ classInfo.batch = batch[0].batch;
|
|
|
+ classInfo.batchname = batch[0].name;
|
|
|
+ classInfo.startdate = batch[0].startdate;
|
|
|
+ classInfo.enddate = batch[0].enddate;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ console.log(classInfo.term);
|
|
|
+ return classInfo;
|
|
|
}
|
|
|
}
|
|
|
|