|
@@ -23,7 +23,8 @@ class AnswerService extends CrudService {
|
|
|
* @property {String} user_id 保安员id
|
|
|
*/
|
|
|
async getExamQuestion({ exam = false, ...info }) {
|
|
|
- const config = await this.configModel.findOne();
|
|
|
+ let config = await this.configModel.findOne();
|
|
|
+ if (config) config = JSON.parse(JSON.stringify(config));
|
|
|
const questionTypeList = await this.questTypeModel.find();
|
|
|
|
|
|
let save = false;
|
|
@@ -85,21 +86,21 @@ class AnswerService extends CrudService {
|
|
|
let mscore = this.computedPercent(5, maxScore);
|
|
|
|
|
|
let limit = 0;
|
|
|
- do {
|
|
|
- for (const p of exam_proportion) {
|
|
|
- const { score } = p;
|
|
|
- if (mscore - score < 0) {
|
|
|
-
|
|
|
- limit++;
|
|
|
- continue;
|
|
|
- } else {
|
|
|
- p.num++;
|
|
|
- mscore -= score;
|
|
|
- lessScore -= score;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- } while (mscore > 0 && limit < 100);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
const exam_plan = exam_proportion.map(i => {
|
|
|
const { score, _id: type, num } = i;
|