lrf há 2 anos atrás
pai
commit
c399315806
1 ficheiros alterados com 3 adições e 2 exclusões
  1. 3 2
      app/service/statistics.js

+ 3 - 2
app/service/statistics.js

@@ -250,7 +250,8 @@ class StatisticsService extends CrudService {
       [ 31, null ],
       [ 31, null ],
     ];
     ];
     const data = [];
     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));
     if (list.length > 0)list = JSON.parse(JSON.stringify(list));
     for (const a of ageList) {
     for (const a of ageList) {
       const start = _.head(a);
       const start = _.head(a);
@@ -260,7 +261,7 @@ class StatisticsService extends CrudService {
       else if (!start) obj.name = `${end}岁以下`;
       else if (!start) obj.name = `${end}岁以下`;
       else if (!end) obj.name = `${start}岁以上`;
       else if (!end) obj.name = `${start}岁以上`;
       const l = list.filter(f => {
       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');
         const age = moment().diff(birth, 'years');
         if (start && end) return age >= start && age <= end;
         if (start && end) return age >= start && age <= end;
         else if (!start) return age <= end;
         else if (!start) return age <= end;