|
@@ -197,7 +197,7 @@ class StatisticsService extends CrudService {
|
|
|
}
|
|
|
|
|
|
|
|
|
- // 学校统计 教练出勤率
|
|
|
+ // 学校统计 每月上课次数
|
|
|
async schoolSignCoach({ school_id, coach_id }) {
|
|
|
assert(school_id, '缺少学校信息');
|
|
|
assert(coach_id, '缺少教练信息');
|
|
@@ -212,7 +212,7 @@ class StatisticsService extends CrudService {
|
|
|
const end = moment(i).endOf('month').format('YYYY-MM-DD HH:mm:ss');
|
|
|
return [ start, end ];
|
|
|
});
|
|
|
- let lcList = await this.lessonCoachModel.find(query, { coach_id: 1, is_sign: 1, meta: 1 });
|
|
|
+ let lcList = await this.lessonCoachModel.find(query, { coach_id: 1, meta: 1 });
|
|
|
if (lcList.length > 0) lcList = JSON.parse(JSON.stringify((lcList)));
|
|
|
const arr = [];
|
|
|
for (const months of monthList) {
|
|
@@ -221,15 +221,7 @@ class StatisticsService extends CrudService {
|
|
|
const m = moment(s).month() + 1;
|
|
|
const obj = { m };
|
|
|
const list = lcList.filter(f => moment(_.get(f, 'meta.createdAt')).isBetween(s, l, null, '[]'));
|
|
|
- let total = 0;
|
|
|
- let is_signed = 0;
|
|
|
- for (const lc of list) {
|
|
|
- if (lc.is_sign === '1') is_signed++;
|
|
|
- total++;
|
|
|
- }
|
|
|
- obj.total = total;
|
|
|
- obj.is_sign = is_signed;
|
|
|
- obj.value = `${_.floor(_.divide(is_signed, total) * 100) || 0}%`;
|
|
|
+ obj.value = list.length;
|
|
|
arr.push(obj);
|
|
|
}
|
|
|
|
|
@@ -251,7 +243,6 @@ class StatisticsService extends CrudService {
|
|
|
];
|
|
|
const data = [];
|
|
|
let list = await this.rssModel.find({ school_id }).populate('student_id', 'birth');
|
|
|
- console.log(list);
|
|
|
if (list.length > 0)list = JSON.parse(JSON.stringify(list));
|
|
|
for (const a of ageList) {
|
|
|
const start = _.head(a);
|