@wg-npm/survey-creator 0.3.377-8.develop → 0.3.3791
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -292,7 +292,7 @@ class QuestionFactory {
|
|
|
292
292
|
}
|
|
293
293
|
|
|
294
294
|
createQuestion(questionType) {
|
|
295
|
-
|
|
295
|
+
const creator = this.creatorHash[questionType];
|
|
296
296
|
return creator(this.locale);
|
|
297
297
|
}
|
|
298
298
|
|
|
@@ -377,7 +377,7 @@ class BaseQuestionModel {
|
|
|
377
377
|
} else if (question.type == "MULTI_SELECTION") {
|
|
378
378
|
return _.sumBy(question.choices, item => parseFloat(_.get(item, "options.score") || 0));
|
|
379
379
|
} else if (question.type == "MATRIX") {
|
|
380
|
-
|
|
380
|
+
const score = _.max(_.map(question.choices, choice => parseFloat(_.get(choice, "options.score", 0) || 0)));
|
|
381
381
|
|
|
382
382
|
return score * question.subQuestions.length;
|
|
383
383
|
}
|
|
@@ -401,7 +401,7 @@ class BaseQuestionModel {
|
|
|
401
401
|
|
|
402
402
|
static calculationAllQuestionCount(questions) {
|
|
403
403
|
let count = 0;
|
|
404
|
-
|
|
404
|
+
const exclude = ["TEXT_TITLE"];
|
|
405
405
|
|
|
406
406
|
_.forEach(questions, question => {
|
|
407
407
|
if (!_.includes(exclude, question.type)) {
|
|
@@ -491,7 +491,7 @@ class QuestionMatrixModel extends BaseQuestionModel {
|
|
|
491
491
|
}
|
|
492
492
|
|
|
493
493
|
static getNumber(preNumber, question) {
|
|
494
|
-
|
|
494
|
+
const number = preNumber + 1;
|
|
495
495
|
|
|
496
496
|
_.forEach(question.subQuestions, (sq, index) => {
|
|
497
497
|
sq.number = index + 1;
|
|
@@ -509,17 +509,17 @@ const EN_US = _.camelCase("en-US");
|
|
|
509
509
|
const ZH_TW = _.camelCase("zh-TW");
|
|
510
510
|
|
|
511
511
|
function getValue(obj, locale) {
|
|
512
|
-
|
|
512
|
+
const value = _.get(obj, _.camelCase(locale), "");
|
|
513
513
|
|
|
514
514
|
if (!_.isEmpty(value)) {
|
|
515
515
|
return value;
|
|
516
516
|
}
|
|
517
517
|
|
|
518
|
-
return _.get(obj, locale,
|
|
518
|
+
return _.get(obj, locale, "");
|
|
519
519
|
}
|
|
520
520
|
|
|
521
521
|
function translate(obj, locale, prettyMath = false) {
|
|
522
|
-
|
|
522
|
+
const value = getValue(obj, locale);
|
|
523
523
|
|
|
524
524
|
if (!_.isEmpty(value) || !prettyMath) {
|
|
525
525
|
return value;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wg-npm/survey-creator",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3791",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"lint-fix": "eslint \"**/*.ts\" \"**/*.vue\" --fix --no-error-on-unmatched-pattern"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@wg-npm/survey-core": "0.3.
|
|
16
|
-
"@wg-npm/survey-service-api": "0.3.
|
|
15
|
+
"@wg-npm/survey-core": "0.3.3791",
|
|
16
|
+
"@wg-npm/survey-service-api": "0.3.3791",
|
|
17
17
|
"axios": "^0.19.2",
|
|
18
18
|
"camelcase": "^6.0.0",
|
|
19
19
|
"deepmerge": "^4.2.2",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"@typescript-eslint/eslint-plugin": "^3.6.0",
|
|
39
39
|
"@typescript-eslint/parser": "^3.6.0",
|
|
40
40
|
"@vue/eslint-config-prettier": "^6.0.0",
|
|
41
|
-
"@wg-npm/survey-core": "0.3.
|
|
42
|
-
"@wg-npm/survey-service-api": "0.3.
|
|
41
|
+
"@wg-npm/survey-core": "0.3.3791",
|
|
42
|
+
"@wg-npm/survey-service-api": "0.3.3791",
|
|
43
43
|
"acorn": "^7.3.1",
|
|
44
44
|
"axios": "^0.19.2",
|
|
45
45
|
"babelrc-rollup": "^3.0.0",
|