瀏覽代碼

增加百分比操作

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;
   }