@wg-npm/survey-creator 0.3.480-5.release → 0.3.489-9.release
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.
|
@@ -287,7 +287,7 @@ class QuestionFactory {
|
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
createQuestion(questionType) {
|
|
290
|
-
|
|
290
|
+
const creator = this.creatorHash[questionType];
|
|
291
291
|
return creator(this.locale);
|
|
292
292
|
}
|
|
293
293
|
|
|
@@ -372,7 +372,7 @@ class BaseQuestionModel {
|
|
|
372
372
|
} else if (question.type == "MULTI_SELECTION") {
|
|
373
373
|
return _.sumBy(question.choices, item => parseFloat(_.get(item, "options.score") || 0));
|
|
374
374
|
} else if (question.type == "MATRIX") {
|
|
375
|
-
|
|
375
|
+
const score = _.max(_.map(question.choices, choice => parseFloat(_.get(choice, "options.score", 0) || 0)));
|
|
376
376
|
|
|
377
377
|
return score * question.subQuestions.length;
|
|
378
378
|
}
|
|
@@ -396,7 +396,7 @@ class BaseQuestionModel {
|
|
|
396
396
|
|
|
397
397
|
static calculationAllQuestionCount(questions) {
|
|
398
398
|
let count = 0;
|
|
399
|
-
|
|
399
|
+
const exclude = ["TEXT_TITLE"];
|
|
400
400
|
|
|
401
401
|
_.forEach(questions, question => {
|
|
402
402
|
if (!_.includes(exclude, question.type)) {
|
|
@@ -486,7 +486,7 @@ class QuestionMatrixModel extends BaseQuestionModel {
|
|
|
486
486
|
}
|
|
487
487
|
|
|
488
488
|
static getNumber(preNumber, question) {
|
|
489
|
-
|
|
489
|
+
const number = preNumber + 1;
|
|
490
490
|
|
|
491
491
|
_.forEach(question.subQuestions, (sq, index) => {
|
|
492
492
|
sq.number = index + 1;
|
|
@@ -504,17 +504,17 @@ const EN_US = _.camelCase("en-US");
|
|
|
504
504
|
const ZH_TW = _.camelCase("zh-TW");
|
|
505
505
|
|
|
506
506
|
function getValue(obj, locale) {
|
|
507
|
-
|
|
507
|
+
const value = _.get(obj, _.camelCase(locale), "");
|
|
508
508
|
|
|
509
509
|
if (!_.isEmpty(value)) {
|
|
510
510
|
return value;
|
|
511
511
|
}
|
|
512
512
|
|
|
513
|
-
return _.get(obj, locale,
|
|
513
|
+
return _.get(obj, locale, "");
|
|
514
514
|
}
|
|
515
515
|
|
|
516
516
|
function translate(obj, locale, prettyMath = false) {
|
|
517
|
-
|
|
517
|
+
const value = getValue(obj, locale);
|
|
518
518
|
|
|
519
519
|
if (!_.isEmpty(value) || !prettyMath) {
|
|
520
520
|
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.4899.release",
|
|
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.4899.release",
|
|
16
|
+
"@wg-npm/survey-service-api": "0.3.4899.release",
|
|
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.4899.release",
|
|
42
|
+
"@wg-npm/survey-service-api": "0.3.4899.release",
|
|
43
43
|
"acorn": "^7.3.1",
|
|
44
44
|
"axios": "^0.19.2",
|
|
45
45
|
"babelrc-rollup": "^3.0.0",
|