Browse Source

增加百分比操作

liuyu 5 years ago
parent
commit
e3c1a0d16a
1 changed files with 3 additions and 1 deletions
  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;
   }