Browse Source

增加百分比操作

liuyu 5 năm trước cách đây
mục cha
commit
e3c1a0d16a
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  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;
   }