commons-assessment 12.0.12 → 12.0.13

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.
@@ -1764,7 +1764,7 @@
1764
1764
  var limit_1 = this.maxFileSize;
1765
1765
  var validFiles = newFiles.filter(function (f) { return limit_1 === 0 || f.size <= limit_1; });
1766
1766
  if (validFiles.length < newFiles.length) {
1767
- this.snackbarMessage.emit({ message: (_a = this.labelConfig['COMMONS_ASSESSMENT.TOAST.FILE_SIZE_EXCEEDED']) === null || _a === void 0 ? void 0 : _a.replace('[SIZE]', this.maxFileSize.toString()), type: 'error' });
1767
+ this.snackbarMessage.emit({ message: (_a = this.labelConfig['COMMONS_ASSESSMENT.TOAST.FILE_SIZE_EXCEEDED']) === null || _a === void 0 ? void 0 : _a.replace('[SIZE]', (this.maxFileSize / (1024 * 1024)).toFixed(2)), type: 'error' });
1768
1768
  }
1769
1769
  validFiles.forEach(function (file) {
1770
1770
  _this.uploadFile(file);
@@ -2050,7 +2050,7 @@
2050
2050
  _this.addControlForQuestion(group, question, question === null || question === void 0 ? void 0 : question.isMandatory);
2051
2051
  if ((_a = question.defaultOptionsList) === null || _a === void 0 ? void 0 : _a.length) {
2052
2052
  question.defaultOptionsList.forEach(function (option) {
2053
- var _a, _b, _c, _d, _e, _f, _g;
2053
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
2054
2054
  if (option.remarksRequired) {
2055
2055
  // Pre-populate remarks if we have answers matching this option.
2056
2056
  var remarkVal = null;
@@ -2058,11 +2058,11 @@
2058
2058
  if (prefilledOptions) {
2059
2059
  var ansObj = (_b = (_a = _this.assesseeResponse) === null || _a === void 0 ? void 0 : _a.aiadefaultResponseList) === null || _b === void 0 ? void 0 : _b.find(function (a) { var _a; return ((_a = a.sectionQuestion) === null || _a === void 0 ? void 0 : _a.questionId) === qId && (!a.childQuestionId || a.childQuestionId === 0); });
2060
2060
  if (ansObj) {
2061
- if (((_c = question.questionType) === null || _c === void 0 ? void 0 : _c.code) === 'QUESTION_TYPE.OBJECTIVE' && prefilledOptions.id === ((_e = (_d = option.options) === null || _d === void 0 ? void 0 : _d.id) !== null && _e !== void 0 ? _e : option.id)) {
2061
+ if (((_c = question.questionType) === null || _c === void 0 ? void 0 : _c.code) === 'QUESTION_TYPE.OBJECTIVE' && (prefilledOptions === ((_e = (_d = option.options) === null || _d === void 0 ? void 0 : _d.id) !== null && _e !== void 0 ? _e : option.id) || (prefilledOptions === null || prefilledOptions === void 0 ? void 0 : prefilledOptions.id) === ((_g = (_f = option.options) === null || _f === void 0 ? void 0 : _f.id) !== null && _g !== void 0 ? _g : option.id))) {
2062
2062
  remarkVal = ansObj.remarks || null;
2063
2063
  }
2064
2064
  else if (Array.isArray(prefilledOptions)) {
2065
- var matchingObj = (_f = ansObj.drobjectiveresponseList) === null || _f === void 0 ? void 0 : _f.find(function (r) { var _a, _b, _c, _d; return ((_b = (_a = r.defaultOption) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.id) === ((_d = (_c = option.options) === null || _c === void 0 ? void 0 : _c.id) !== null && _d !== void 0 ? _d : option.id); });
2065
+ var matchingObj = (_h = ansObj.drobjectiveresponseList) === null || _h === void 0 ? void 0 : _h.find(function (r) { var _a, _b, _c, _d; return ((_b = (_a = r.defaultOption) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.id) === ((_d = (_c = option.options) === null || _c === void 0 ? void 0 : _c.id) !== null && _d !== void 0 ? _d : option.id); });
2066
2066
  if (matchingObj) {
2067
2067
  remarkVal = matchingObj.remarks || null;
2068
2068
  }
@@ -2076,7 +2076,7 @@
2076
2076
  ;
2077
2077
  group[qId + "_remarks_" + option.id] = remarkCtrl;
2078
2078
  }
2079
- (_g = option.childQuestionList) === null || _g === void 0 ? void 0 : _g.forEach(function (childId) {
2079
+ (_j = option.childQuestionList) === null || _j === void 0 ? void 0 : _j.forEach(function (childId) {
2080
2080
  var _a, _b;
2081
2081
  var childQues = _this.questionBank[childId];
2082
2082
  if (childQues) {
@@ -2094,7 +2094,7 @@
2094
2094
  return;
2095
2095
  var question = _this.questionBank[qId];
2096
2096
  if ((_a = question.defaultOptionsList) === null || _a === void 0 ? void 0 : _a.length) {
2097
- (_b = fg.get(qId.toString())) === null || _b === void 0 ? void 0 : _b.valueChanges.subscribe(function (val) {
2097
+ (_b = fg.get(qId === null || qId === void 0 ? void 0 : qId.toString())) === null || _b === void 0 ? void 0 : _b.valueChanges.subscribe(function (val) {
2098
2098
  var _a;
2099
2099
  (_a = question.defaultOptionsList) === null || _a === void 0 ? void 0 : _a.forEach(function (option) {
2100
2100
  var _a, _b;
@@ -2112,9 +2112,10 @@
2112
2112
  }
2113
2113
  if ((_b = option.childQuestionList) === null || _b === void 0 ? void 0 : _b.length) {
2114
2114
  option.childQuestionList.forEach(function (childId) {
2115
+ var _a;
2115
2116
  var childQues = _this.questionBank[childId];
2116
2117
  if (childQues === null || childQues === void 0 ? void 0 : childQues.id) {
2117
- var childCtrl = fg.get(childQues.id.toString());
2118
+ var childCtrl = fg.get((_a = childQues.id) === null || _a === void 0 ? void 0 : _a.toString());
2118
2119
  if (isSelected) {
2119
2120
  var validators = _this.getValidatorsForQuestion(childQues, childQues.isMandatory || false).filter(function (v) { return !!v; });
2120
2121
  childCtrl === null || childCtrl === void 0 ? void 0 : childCtrl.setValidators(i1$2.Validators.compose(validators));
@@ -3018,7 +3019,7 @@
3018
3019
  };
3019
3020
  AssessmentBuilderService.prototype.generateAssessmentDTO = function (assessmentId, questionPaper) {
3020
3021
  var _a;
3021
- return Object.assign({ id: assessmentId, totallMarks: ((_a = questionPaper === null || questionPaper === void 0 ? void 0 : questionPaper.questionPaperSectionList) === null || _a === void 0 ? void 0 : _a.filter(function (section) { return section.isActive !== false; }).reduce(function (acc, section) { return acc + (section.totalMarks || 0); }, 0)) || 0 }, (!assessmentId && Object.assign({}, this.defaultAssessmentDTO)));
3022
+ return Object.assign(Object.assign({ id: assessmentId, totallMarks: ((_a = questionPaper === null || questionPaper === void 0 ? void 0 : questionPaper.questionPaperSectionList) === null || _a === void 0 ? void 0 : _a.filter(function (section) { return section.isActive !== false; }).reduce(function (acc, section) { return acc + (section.totalMarks || 0); }, 0)) || 0 }, (!assessmentId && Object.assign({}, this.defaultAssessmentDTO))), { cacheEvictionEnabled: true });
3022
3023
  };
3023
3024
  AssessmentBuilderService.prototype.generateAssessmentInstanceDTO = function (assessmentId) {
3024
3025
  var _a, _b;
@@ -3611,8 +3612,8 @@
3611
3612
  customRegex: '',
3612
3613
  hintText: '',
3613
3614
  questionMedia: '',
3614
- childQuestions: [[]],
3615
- skillCodes: [[]]
3615
+ childQuestions: [],
3616
+ skillCodes: []
3616
3617
  });
3617
3618
  var optionsControl = this.questionsFormGroup.get('options');
3618
3619
  while (optionsControl.length !== 0) {