|
@@ -192,7 +192,10 @@ class BedroomService extends CrudService {
|
|
|
const stuBedIdGroup = _.groupBy(stuList, 'bedroomid');
|
|
|
const keys = Object.keys(stuBedIdGroup);
|
|
|
// 过滤出没有人的寝室
|
|
|
- let noperson = bedroomList.filter(f => !(keys.find(k => ObjectId(k).equals(f._id))));
|
|
|
+ let noperson = bedroomList.filter(f => !(keys.find(k => {
|
|
|
+ if (k === undefined || k === 'undefined') return false;
|
|
|
+ return ObjectId(k).equals(f._id);
|
|
|
+ })));
|
|
|
noperson = JSON.parse(JSON.stringify(noperson));
|
|
|
const nopersonList = [];
|
|
|
for (const i of noperson) {
|
|
@@ -202,6 +205,7 @@ class BedroomService extends CrudService {
|
|
|
}
|
|
|
const havepersonList = [];
|
|
|
for (const key of keys) {
|
|
|
+ if (key === undefined || key === 'undefined') continue;
|
|
|
// 取出分组后,以寝室id为key的学生列表
|
|
|
const list = stuBedIdGroup[key];
|
|
|
// 找到寝室obj
|