lrf 2 yıl önce
ebeveyn
işleme
c399315806
1 değiştirilmiş dosya ile 3 ekleme ve 2 silme
  1. 3 2
      app/service/statistics.js

+ 3 - 2
app/service/statistics.js

@@ -250,7 +250,8 @@ class StatisticsService extends CrudService {
       [ 31, null ],
     ];
     const data = [];
-    let list = await this.rssModel.find({ school_id }).populate('student_id', 'age');
+    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);
@@ -260,7 +261,7 @@ class StatisticsService extends CrudService {
       else if (!start) obj.name = `${end}岁以下`;
       else if (!end) obj.name = `${start}岁以上`;
       const l = list.filter(f => {
-        const birth = _.get(f, 'sstudent_id.birth');
+        const birth = _.get(f, 'student_id.birth');
         const age = moment().diff(birth, 'years');
         if (start && end) return age >= start && age <= end;
         else if (!start) return age <= end;