فهرست منبع

增加百分比操作

liuyu 5 سال پیش
والد
کامیت
e3c1a0d16a
1فایلهای تغییر یافته به همراه3 افزوده شده و 1 حذف شده
  1. 3 1
      app/service/uploadquestion.js

+ 3 - 1
app/service/uploadquestion.js

@@ -37,7 +37,9 @@ class UploadquestionService extends CrudService {
       answercount = await this.model.count({ classid: typeid });
     }
 
-    const newdata = { allcount, answercount };
+    let completion = (answercount / allcount * 100).toFixed(2);
+    completion = completion + '%';
+    const newdata = { allcount, answercount, completion };
     return newdata;
   }