lrf402788946 4 tahun lalu
induk
melakukan
6c9b57771a
1 mengubah file dengan 4 tambahan dan 2 penghapusan
  1. 4 2
      app/service/score.js

+ 4 - 2
app/service/score.js

@@ -15,10 +15,11 @@ class ScoreService extends CrudService {
   }
   }
 
 
   async create(data) {
   async create(data) {
-    const { lessonid, stuid, teacherid, score } = data;
+    const { lessonid, stuid, teacherid, score, remark } = data;
     let res = await this.model.findOne({ stuid, lessonid, teacherid });
     let res = await this.model.findOne({ stuid, lessonid, teacherid });
     if (res) {
     if (res) {
       if (score) res.score = score;
       if (score) res.score = score;
+      if (remark)res.remark = remark;
       res = await res.save();
       res = await res.save();
     } else {
     } else {
       res = await this.model.create(data);
       res = await this.model.create(data);
@@ -29,11 +30,12 @@ class ScoreService extends CrudService {
   }
   }
 
 
 
 
-  async update({ id, score }) {
+  async update({ id, score, remark }) {
     const r = await this.model.findById(id);
     const r = await this.model.findById(id);
     if (r) {
     if (r) {
       // 修改分数,重置状态,下面重新计算
       // 修改分数,重置状态,下面重新计算
       r.score = score;
       r.score = score;
+      r.remark = remark;
       await r.save();
       await r.save();
     }
     }
     this.computedScore({ teacherid: r.teacherid });
     this.computedScore({ teacherid: r.teacherid });