@wg-npm/survey-core 0.3.18180 → 0.3.22256

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.
@@ -129,13 +129,13 @@ class BaseQuestionModel {
129
129
  }
130
130
  static getMaxScore(question) {
131
131
  if (question.type == "SINGLE_SELECTION") {
132
- return _.max(_.map(question.choices, (choice) => parseFloat(_.get(choice, "options.score", 0) || 0)));
132
+ return _.max(_.map(question.choices, (choice) => parseFloat(_.get(choice, "options.score", 0) || 0))) || 0;
133
133
  }
134
134
  else if (question.type == "MULTI_SELECTION") {
135
135
  return _.sumBy(question.choices, (item) => parseFloat(_.get(item, "options.score") || 0));
136
136
  }
137
137
  else if (question.type == "MATRIX") {
138
- const score = _.max(_.map(question.choices, (choice) => parseFloat(_.get(choice, "options.score", 0) || 0)));
138
+ const score = _.max(_.map(question.choices, (choice) => parseFloat(_.get(choice, "options.score", 0) || 0))) || 0;
139
139
  return score * question.subQuestions.length;
140
140
  }
141
141
  return 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wg-npm/survey-core",
3
- "version": "0.3.18180",
3
+ "version": "0.3.22256",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "scripts": {
package/src/models.ts CHANGED
@@ -178,7 +178,7 @@ export class BaseQuestionModel {
178
178
  _.map(question.choices, (choice) =>
179
179
  parseFloat(_.get(choice, "options.score", 0) || 0)
180
180
  )
181
- );
181
+ ) || 0;
182
182
  } else if (question.type == QuestionType.MULTI_SELECTION) {
183
183
  return _.sumBy(question.choices, (item) =>
184
184
  parseFloat(_.get(item, "options.score") || 0)
@@ -188,7 +188,7 @@ export class BaseQuestionModel {
188
188
  _.map(question.choices, (choice) =>
189
189
  parseFloat(_.get(choice, "options.score", 0) || 0)
190
190
  )
191
- );
191
+ ) || 0;
192
192
  return score * question.subQuestions.length;
193
193
  }
194
194
  return 0;