소스 검색

增加百分比操作

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