lrf402788946 4 gadi atpakaļ
vecāks
revīzija
928e1b6d31
1 mainītis faili ar 8 papildinājumiem un 8 dzēšanām
  1. 8 8
      app/service/lesson.js

+ 8 - 8
app/service/lesson.js

@@ -330,8 +330,8 @@ class LessonService extends CrudService {
       const headteacher = await this.headteamodel.findById(headteacherid);
       if (headteacher) {
         const r = await this.toSendMsg(headteacher, 'headteacher', termnum, nres._id, content);
-        if (r && is_update) nres.notified.push(r);
-        else if (r && !is_update) {
+        if (r && !is_update) nres.notified.push(r);
+        else if (r && is_update) {
           const dr = nres.notified.find(f => f.notifiedid === r.notifiedid);
           if (!dr) nres.notified.push(r);
         }
@@ -341,8 +341,8 @@ class LessonService extends CrudService {
         let lyTeacher = await this.headteamodel.findById(lyteacherid);
         if (lyTeacher) {
           const r = await this.toSendMsg(lyTeacher, 'headteacher', termnum, nres._id, content);
-          if (r && is_update) nres.notified.push(r);
-          else if (r && !is_update) {
+          if (r && !is_update) nres.notified.push(r);
+          else if (r && is_update) {
             const dr = nres.notified.find(f => f.notifiedid === r.notifiedid);
             if (!dr) nres.notified.push(r);
           }
@@ -350,8 +350,8 @@ class LessonService extends CrudService {
           lyTeacher = await this.teamodel.findById(lyteacherid);
           if (lyTeacher) {
             const r = await this.toSendMsg(lyTeacher, 'teacher', termnum, nres._id, content);
-            if (r && is_update) nres.notified.push(r);
-            else if (r && !is_update) {
+            if (r && !is_update) nres.notified.push(r);
+            else if (r && is_update) {
               const dr = nres.notified.find(f => f.notifiedid === r.notifiedid);
               if (!dr) nres.notified.push(r);
             }
@@ -365,8 +365,8 @@ class LessonService extends CrudService {
           const teacher = await this.teamodel.findById(tea);
           if (!teacher) continue;
           const r = await this.toSendMsg(teacher, 'teacher', termnum, nres._id, content);
-          if (r && is_update) nres.notified.push(r);
-          else if (r && !is_update) {
+          if (r && !is_update) nres.notified.push(r);
+          else if (r && is_update) {
             const dr = nres.notified.find(f => f.notifiedid === r.notifiedid);
             if (!dr) nres.notified.push(r);
           }