mario-education 2.4.268-release → 2.4.271-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.
@@ -29,6 +29,7 @@ interface Props {
29
29
  isQuestionIntervention?: boolean;
30
30
  correctQuestionAnswer?: string[];
31
31
  isPreviewPage?: boolean;
32
+ answer?: any;
32
33
  }
33
34
  declare const QuestionSurveyComponent: FC<Props>;
34
35
  export default QuestionSurveyComponent;
@@ -11,6 +11,7 @@ interface Props {
11
11
  isStudent?: boolean;
12
12
  isStartRecord?: boolean;
13
13
  isPreviewPage?: boolean;
14
+ checkIsQuestionFlag?: any;
14
15
  }
15
16
  declare const QuestionConduct: FC<Props>;
16
17
  export default QuestionConduct;
@@ -27,5 +27,6 @@ declare const useConductSurvey: () => {
27
27
  isDone: boolean;
28
28
  currentPage: import("react").ReactText;
29
29
  updateAnswerInterventionLog: (answer: any, callback?: Function | undefined) => Promise<void>;
30
+ checkIsQuestionFlag: (arrData?: any) => boolean;
30
31
  };
31
32
  export default useConductSurvey;
package/dist/index.js CHANGED
@@ -47410,6 +47410,42 @@ var startExternalSurvey = function startExternalSurvey(body) {
47410
47410
  return marioCore.api.put(EXTERNAL_SURVEY$2 + "/external-link", body);
47411
47411
  };
47412
47412
 
47413
+ var QuestionType$2;
47414
+
47415
+ (function (QuestionType) {
47416
+ QuestionType["Default"] = "Default";
47417
+ QuestionType["SingleChoice"] = "SingleChoice";
47418
+ QuestionType["MultipleChoice"] = "MultipleChoice";
47419
+ QuestionType["TextInput"] = "TextInput";
47420
+ QuestionType["Slider"] = "Slider";
47421
+ QuestionType["ProgressBar"] = "ProgressBar";
47422
+ QuestionType["StarRating"] = "StarRating";
47423
+ QuestionType["TextInputWithSuggestions"] = "TextInputWithSuggestions";
47424
+ QuestionType["Emotional"] = "Emotional";
47425
+ QuestionType["Summarize"] = "Summarize";
47426
+ QuestionType["Rating"] = "Rating";
47427
+ QuestionType["LearningStrategy"] = "LearningStrategy";
47428
+ QuestionType["DropDown"] = "DropDown";
47429
+ })(QuestionType$2 || (QuestionType$2 = {}));
47430
+
47431
+ var TypeTime;
47432
+
47433
+ (function (TypeTime) {
47434
+ TypeTime[TypeTime["Default"] = 0] = "Default";
47435
+ TypeTime[TypeTime["StartTime"] = 1] = "StartTime";
47436
+ TypeTime[TypeTime["StopTime"] = 2] = "StopTime";
47437
+ })(TypeTime || (TypeTime = {}));
47438
+
47439
+ var RoleStartSessionEnum;
47440
+
47441
+ (function (RoleStartSessionEnum) {
47442
+ RoleStartSessionEnum[RoleStartSessionEnum["Assistant"] = 0] = "Assistant";
47443
+ RoleStartSessionEnum[RoleStartSessionEnum["Teacher"] = 1] = "Teacher";
47444
+ RoleStartSessionEnum[RoleStartSessionEnum["Student"] = 2] = "Student";
47445
+ RoleStartSessionEnum[RoleStartSessionEnum["Counselor"] = 3] = "Counselor";
47446
+ RoleStartSessionEnum[RoleStartSessionEnum["SecondaryTeacher"] = 4] = "SecondaryTeacher";
47447
+ })(RoleStartSessionEnum || (RoleStartSessionEnum = {}));
47448
+
47413
47449
  var LegalGenderType$2;
47414
47450
 
47415
47451
  (function (LegalGenderType) {
@@ -47449,6 +47485,90 @@ var getAnswerType = function getAnswerType(text, isAlert) {
47449
47485
  if (val <= 100 && !isAlert) return ANSWER_TYPES.ALL_THE_TIME;
47450
47486
  return null;
47451
47487
  };
47488
+ var getAnswerTypeV2 = function getAnswerTypeV2(answer) {
47489
+ var _answer$answer;
47490
+
47491
+ switch (answer === null || answer === void 0 ? void 0 : answer.type) {
47492
+ case QuestionType$2.Emotional:
47493
+ var findItem = ((answer === null || answer === void 0 ? void 0 : answer.emotionalQuestionAnswers) || []).find(function (e) {
47494
+ return e.text === answer.answer;
47495
+ });
47496
+
47497
+ if (findItem) {
47498
+ switch (findItem.flag) {
47499
+ case "RedFlag":
47500
+ return ANSWER_TYPES.NEVER;
47501
+
47502
+ case "YellowFlag":
47503
+ return ANSWER_TYPES.SOMETIMES;
47504
+
47505
+ case "GreenFlag":
47506
+ return null;
47507
+
47508
+ default:
47509
+ return null;
47510
+ }
47511
+ }
47512
+
47513
+ break;
47514
+
47515
+ case QuestionType$2.MultipleChoice:
47516
+ var answered = (answer === null || answer === void 0 ? void 0 : (_answer$answer = answer.answer) === null || _answer$answer === void 0 ? void 0 : _answer$answer.split(";")) || [];
47517
+ var dataAnswer = (answer === null || answer === void 0 ? void 0 : answer.dataAnswer) || [];
47518
+
47519
+ if (answered.length <= 0 && dataAnswer.length <= 0) {
47520
+ return;
47521
+ }
47522
+
47523
+ var filtered = dataAnswer.filter(function (data) {
47524
+ return answered.includes(data.text);
47525
+ }).map(function (e) {
47526
+ return e === null || e === void 0 ? void 0 : e.flag;
47527
+ });
47528
+
47529
+ if (filtered.includes("RedFlag")) {
47530
+ return ANSWER_TYPES.NEVER;
47531
+ } else if (filtered.includes("YellowFlag")) {
47532
+ return ANSWER_TYPES.SOMETIMES;
47533
+ } else if (filtered.includes("GreenFlag")) {
47534
+ return null;
47535
+ } else {
47536
+ return null;
47537
+ }
47538
+
47539
+ case QuestionType$2.SingleChoice:
47540
+ case QuestionType$2.DropDown:
47541
+ var dataAnswerSingleChoice = (answer === null || answer === void 0 ? void 0 : answer.dataAnswer) || [];
47542
+
47543
+ if (dataAnswerSingleChoice.length <= 0) {
47544
+ return;
47545
+ }
47546
+
47547
+ var findItemChoice = dataAnswerSingleChoice.find(function (data) {
47548
+ return data.text === (answer === null || answer === void 0 ? void 0 : answer.answer);
47549
+ });
47550
+
47551
+ if (findItemChoice) {
47552
+ switch (findItemChoice.flag) {
47553
+ case "RedFlag":
47554
+ return ANSWER_TYPES.NEVER;
47555
+
47556
+ case "YellowFlag":
47557
+ return ANSWER_TYPES.SOMETIMES;
47558
+
47559
+ case "GreenFlag":
47560
+ return null;
47561
+
47562
+ default:
47563
+ return null;
47564
+ }
47565
+ }
47566
+
47567
+ break;
47568
+ }
47569
+
47570
+ return null;
47571
+ };
47452
47572
 
47453
47573
  var useSurveyDetail = function useSurveyDetail() {
47454
47574
  var dispatch = reactRedux.useDispatch();
@@ -50210,13 +50330,13 @@ var NOTIFICATION_HEIGHT = 36;
50210
50330
  var LOGO = "" + marioCore.getStaticFileUrl("/images/logo-white.svg");
50211
50331
 
50212
50332
  var _templateObject$1;
50213
- var TypeTime;
50333
+ var TypeTime$1;
50214
50334
 
50215
50335
  (function (TypeTime) {
50216
50336
  TypeTime[TypeTime["Default"] = 0] = "Default";
50217
50337
  TypeTime[TypeTime["StartTime"] = 1] = "StartTime";
50218
50338
  TypeTime[TypeTime["StopTime"] = 2] = "StopTime";
50219
- })(TypeTime || (TypeTime = {}));
50339
+ })(TypeTime$1 || (TypeTime$1 = {}));
50220
50340
 
50221
50341
  var Header = styled.div(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteralLoose(["\n position: fixed;\n top: ", "px;\n width: 100%;\n display: flex;\n height: 76px;\n justify-content: space-between;\n align-items: center;\n padding: 20px 16px;\n border-bottom: 1px solid #a3a2a2;\n background: #fff;\n z-index: 99;\n width: ", "px;\n transition: width 200ms;\n @media (max-width: 600px) {\n width: 100%;\n top: ", "px;\n }\n"])), function (props) {
50222
50342
  return HEADER_DESKTOP_HEIGHT + (props.isOpenNotificationAlert ? NOTIFICATION_HEIGHT : 0);
@@ -50553,42 +50673,6 @@ var SliderSurveyComponent = function SliderSurveyComponent(_ref) {
50553
50673
  }));
50554
50674
  };
50555
50675
 
50556
- var QuestionType$2;
50557
-
50558
- (function (QuestionType) {
50559
- QuestionType["Default"] = "Default";
50560
- QuestionType["SingleChoice"] = "SingleChoice";
50561
- QuestionType["MultipleChoice"] = "MultipleChoice";
50562
- QuestionType["TextInput"] = "TextInput";
50563
- QuestionType["Slider"] = "Slider";
50564
- QuestionType["ProgressBar"] = "ProgressBar";
50565
- QuestionType["StarRating"] = "StarRating";
50566
- QuestionType["TextInputWithSuggestions"] = "TextInputWithSuggestions";
50567
- QuestionType["Emotional"] = "Emotional";
50568
- QuestionType["Summarize"] = "Summarize";
50569
- QuestionType["Rating"] = "Rating";
50570
- QuestionType["LearningStrategy"] = "LearningStrategy";
50571
- QuestionType["DropDown"] = "DropDown";
50572
- })(QuestionType$2 || (QuestionType$2 = {}));
50573
-
50574
- var TypeTime$1;
50575
-
50576
- (function (TypeTime) {
50577
- TypeTime[TypeTime["Default"] = 0] = "Default";
50578
- TypeTime[TypeTime["StartTime"] = 1] = "StartTime";
50579
- TypeTime[TypeTime["StopTime"] = 2] = "StopTime";
50580
- })(TypeTime$1 || (TypeTime$1 = {}));
50581
-
50582
- var RoleStartSessionEnum;
50583
-
50584
- (function (RoleStartSessionEnum) {
50585
- RoleStartSessionEnum[RoleStartSessionEnum["Assistant"] = 0] = "Assistant";
50586
- RoleStartSessionEnum[RoleStartSessionEnum["Teacher"] = 1] = "Teacher";
50587
- RoleStartSessionEnum[RoleStartSessionEnum["Student"] = 2] = "Student";
50588
- RoleStartSessionEnum[RoleStartSessionEnum["Counselor"] = 3] = "Counselor";
50589
- RoleStartSessionEnum[RoleStartSessionEnum["SecondaryTeacher"] = 4] = "SecondaryTeacher";
50590
- })(RoleStartSessionEnum || (RoleStartSessionEnum = {}));
50591
-
50592
50676
  var useStyles$2 = core$1.makeStyles(function (theme) {
50593
50677
  var _container, _title, _activeImg, _node, _pNthChild, _active, _answers;
50594
50678
 
@@ -51047,7 +51131,8 @@ var QuestionSurveyComponent = function QuestionSurveyComponent(_ref) {
51047
51131
  isStartRecord = _ref.isStartRecord,
51048
51132
  isQuestionIntervention = _ref.isQuestionIntervention,
51049
51133
  correctQuestionAnswer = _ref.correctQuestionAnswer,
51050
- isPreviewPage = _ref.isPreviewPage;
51134
+ isPreviewPage = _ref.isPreviewPage,
51135
+ answer = _ref.answer;
51051
51136
  var defaultFontSmall = 12;
51052
51137
  var defaultFontLarge = 20;
51053
51138
  var defaultFont = reactRedux.useSelector(function (state) {
@@ -51165,15 +51250,20 @@ var QuestionSurveyComponent = function QuestionSurveyComponent(_ref) {
51165
51250
  };
51166
51251
 
51167
51252
  var checkHasIntervention = function checkHasIntervention(_key) {
51168
- if (questionTypeId !== QuestionType$2.Slider && questionTypeId !== QuestionType$2.Rating && questionTypeId !== QuestionType$2.SingleChoice) return false;
51253
+ if (questionTypeId !== QuestionType$2.Slider && questionTypeId !== QuestionType$2.Rating && questionTypeId !== QuestionType$2.SingleChoice && questionTypeId !== QuestionType$2.MultipleChoice && questionTypeId !== QuestionType$2.Emotional && questionTypeId !== QuestionType$2.DropDown) return false;
51169
51254
  return isQuestionIntervention;
51170
51255
  };
51171
51256
 
51172
51257
  var getAnswerValueType = function getAnswerValueType() {
51173
- var _getAnswerType;
51258
+ if (questionTypeId !== QuestionType$2.Slider && questionTypeId !== QuestionType$2.Rating && questionTypeId !== QuestionType$2.SingleChoice && questionTypeId !== QuestionType$2.MultipleChoice && questionTypeId !== QuestionType$2.Emotional && questionTypeId !== QuestionType$2.DropDown) return null;
51174
51259
 
51175
- if (questionTypeId !== QuestionType$2.Slider && questionTypeId !== QuestionType$2.Rating && questionTypeId !== QuestionType$2.SingleChoice) return null;
51176
- return (_getAnswerType = getAnswerType(valueText, true)) === null || _getAnswerType === void 0 ? void 0 : _getAnswerType.replaceAll(" ", "-");
51260
+ if (questionTypeId === QuestionType$2.Slider || questionTypeId === QuestionType$2.Rating) {
51261
+ var _getAnswerType;
51262
+
51263
+ return (_getAnswerType = getAnswerType(valueText, true)) === null || _getAnswerType === void 0 ? void 0 : _getAnswerType.replaceAll(" ", "-");
51264
+ } else {
51265
+ return getAnswerTypeV2(answer);
51266
+ }
51177
51267
  };
51178
51268
 
51179
51269
  var answerType = React.useMemo(function () {
@@ -51247,13 +51337,14 @@ var QuestionConduct = function QuestionConduct(_ref) {
51247
51337
  onOpenIntervention = _ref.onOpenIntervention,
51248
51338
  isStudent = _ref.isStudent,
51249
51339
  isStartRecord = _ref.isStartRecord,
51250
- isPreviewPage = _ref.isPreviewPage;
51340
+ isPreviewPage = _ref.isPreviewPage,
51341
+ checkIsQuestionFlag = _ref.checkIsQuestionFlag;
51251
51342
  return React__default.createElement("div", {
51252
51343
  className: styles$7["box-question"]
51253
51344
  }, !!questionName && React__default.createElement("h2", {
51254
51345
  className: styles$7["font-title"]
51255
51346
  }, questionName), !!questionList && questionList.length > 0 && questionList.map(function (item) {
51256
- var _item$text, _item$text$toLowerCas, _item$isQuestionInter;
51347
+ var _item$text, _item$text$toLowerCas;
51257
51348
 
51258
51349
  return React__default.createElement(React__default.Fragment, {
51259
51350
  key: item.id
@@ -51281,9 +51372,10 @@ var QuestionConduct = function QuestionConduct(_ref) {
51281
51372
  onOpenIntervention: onOpenIntervention,
51282
51373
  isStudent: isStudent,
51283
51374
  isStartRecord: isStartRecord,
51284
- isQuestionIntervention: (_item$isQuestionInter = item === null || item === void 0 ? void 0 : item.isQuestionIntervention) != null ? _item$isQuestionInter : false,
51375
+ isQuestionIntervention: (item === null || item === void 0 ? void 0 : item.isQuestionIntervention) || (item !== null && item !== void 0 && item.dataAnswer || item !== null && item !== void 0 && item.emotionalQuestionAnswers ? checkIsQuestionFlag(item.type === QuestionType$2.Emotional ? item === null || item === void 0 ? void 0 : item.emotionalQuestionAnswers : item === null || item === void 0 ? void 0 : item.dataAnswer) : false),
51285
51376
  correctQuestionAnswer: item === null || item === void 0 ? void 0 : item.correctQuestionAnswer,
51286
- isPreviewPage: isPreviewPage
51377
+ isPreviewPage: isPreviewPage,
51378
+ answer: item
51287
51379
  }));
51288
51380
  }));
51289
51381
  };
@@ -59102,6 +59194,25 @@ var useConductSurvey = function useConductSurvey() {
59102
59194
  pusher && pusher.unsubscribe("SURVEY_PLAYER_" + surveyId + "_" + studentId);
59103
59195
  };
59104
59196
  }, []);
59197
+
59198
+ var checkIsQuestionFlag = function checkIsQuestionFlag(arrData) {
59199
+ if (arrData === void 0) {
59200
+ arrData = [];
59201
+ }
59202
+
59203
+ if (arrData && arrData.length) {
59204
+ for (var _iterator = _createForOfIteratorHelperLoose(arrData), _step; !(_step = _iterator()).done;) {
59205
+ var item = _step.value;
59206
+
59207
+ if (item.hasOwnProperty('flag')) {
59208
+ return true;
59209
+ }
59210
+ }
59211
+ }
59212
+
59213
+ return false;
59214
+ };
59215
+
59105
59216
  return {
59106
59217
  currentUser: currentUser,
59107
59218
  isTeacher: isTeacher,
@@ -59129,7 +59240,8 @@ var useConductSurvey = function useConductSurvey() {
59129
59240
  isSchedule: isSchedule,
59130
59241
  isDone: isDone,
59131
59242
  currentPage: currentPage,
59132
- updateAnswerInterventionLog: updateAnswerInterventionLog
59243
+ updateAnswerInterventionLog: updateAnswerInterventionLog,
59244
+ checkIsQuestionFlag: checkIsQuestionFlag
59133
59245
  };
59134
59246
  };
59135
59247
 
@@ -77140,7 +77252,8 @@ var SurveyResultAdmin = function SurveyResultAdmin() {
77140
77252
  isSchedule = _useConductSurvey.isSchedule,
77141
77253
  isDone = _useConductSurvey.isDone,
77142
77254
  currentPage = _useConductSurvey.currentPage,
77143
- updateAnswerInterventionLog = _useConductSurvey.updateAnswerInterventionLog;
77255
+ updateAnswerInterventionLog = _useConductSurvey.updateAnswerInterventionLog,
77256
+ checkIsQuestionFlag = _useConductSurvey.checkIsQuestionFlag;
77144
77257
 
77145
77258
  var _useState = React.useState(undefined),
77146
77259
  question = _useState[0],
@@ -77288,7 +77401,8 @@ var SurveyResultAdmin = function SurveyResultAdmin() {
77288
77401
  isPageSessionResult: false,
77289
77402
  isPageResult: true,
77290
77403
  onOpenIntervention: handleOpenIntervention,
77291
- isStudent: isStudent
77404
+ isStudent: isStudent,
77405
+ checkIsQuestionFlag: checkIsQuestionFlag
77292
77406
  }))));
77293
77407
  }), React__default.createElement("div", {
77294
77408
  className: styles$7["talk-conduct"]
@@ -77301,7 +77415,8 @@ var SurveyResultAdmin = function SurveyResultAdmin() {
77301
77415
  questionList: listAdditionalQuestionAnswer,
77302
77416
  isPageSessionResult: false,
77303
77417
  onOpenIntervention: handleOpenIntervention,
77304
- isPageResult: true
77418
+ isPageResult: true,
77419
+ checkIsQuestionFlag: checkIsQuestionFlag
77305
77420
  }))))), React__default.createElement(ScrollToTopBtn, null));
77306
77421
  };
77307
77422