catchup-library-web 2.6.22 → 2.6.24

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.
package/dist/index.d.mts CHANGED
@@ -603,6 +603,8 @@ declare const retrieveActivityCountOptionList: () => {
603
603
  value: number;
604
604
  text: number;
605
605
  }[];
606
+ declare const checkAnswerState: (correctAnswer: any, learnerAnswer: any) => string;
607
+ declare const checkIsActivityAnswerFullyCorrect: (activityTemplateType: string, answerMap: any, activityData: any) => any;
606
608
 
607
609
  declare const retrieveCurriculumTypeOptionList: () => {
608
610
  value: string;
@@ -955,4 +957,4 @@ declare const retrieveActivityMethodologyOptionList: () => {
955
957
  text: string;
956
958
  }[];
957
959
 
958
- export { ActivityBodyContent, ActivityEmptyContent, ActivityEvaluationRubricContent, ActivityPreviewByData, ActivitySolutionContent, AmberLabel, ApproveButton, BaseCard, BaseImage, BaseLoading, BaseLoadingWithText, BaseModal, BasePDF, BaseTitle, BlueLabel, BlueVerticalDividerLine, CancelButton, CoralLabel, CreateButton, CyanLabel, DeleteButton, DividerLine, DropdownActivityContent, FillInTheBlanksActivityContent, FullCard, GrayLabel, GreenLabel, GroupingActivityContent, InfoWithText, InputGroup, InputWithSpecialExpression, LeftTextRightInputGroup, LimeLabel, MCMAActivityContent, MCSAActivityContent, MatchingActivityContent, ONE_DAY, ONE_HOUR, ONE_MONTH, ONE_WEEK, OpenEndedActivityContent, OrangeLabel, OrderingActivityContent, PageTravelGroup, PrimaryButton, ProgressBar, PurpleLabel, RedLabel, ScoreBar, SecondaryButton, SelectionBox, SelectionCheckbox, SelectionTab, SelectionTabFill, SelectionTabPill, StartButton, StatusError, SubTitle, THREE_MONTHS, TealLabel, TimedProgressBar, TrueFalseActivityContent, VerticalDividerLine, base64ToFile, calculateEndDateOfWeek, calculateLevenshteinDistance, calculateStartDateOfWeek, checkActivityAnswerState, constructActivityAnswerMap, constructActivityAnswerStateList, constructActivityData, constructActivityItemListBodyOnly, constructActivityItemListForSolution, constructActivityItemListMaterialOnly, constructActivityItemListSolutionOnly, constructActivityItemListWithAnswersForAI, constructActivityItemListWithSolutionForAI, constructAnswerBasedOnData, constructBaseNumericIndividualModel, constructBaseVerbalIndvidualModel, constructCategoryTreeFromParentCode, constructCombinedCorporateAssessmentAssignmentReportMap, constructCombinedOutcomeActivityScoreMapFromCombinedReport, constructInputWithSpecialExpressionList, constructMonthName, constructOutcomeActivityScoreList, constructUserProfileQueryParams, constructWeekName, convertDataURLtoFile, convertToBase64, convertToBodyMapString, convertToEvaluationRubricMapString, convertToSolutionMapString, convertTurkishCharactersToEnglish, decodeJWT, encodeJWT, filterCategoryVersionCodeOptionList, filterCategoryVersionCodeOptionListByGradeDTO, filterCategoryVersionCodeOptionListByInstitutionDTO, filterCoterieTypeByDistinctOptionList, filterCoterieTypeOptionList, filterCurriculumTypeOptionList, filterGradeLevelOptionList, filterSkillVersionCodeOptionList, filterUserRoleOptionList, findAISettingsFromCurrentProfile, findBestFitActivity, formatPriceWithCommas, getColorByIndex, getCurrentDateTime, getLanguageFromCode, getLanguageFromCurriculumType, getOneWeekLater, getSystemLanguageFromCurriculumType, ignoreMathematicalExpression, mergeObjects, parseBodyMapFromData, parseContentMapFromData, parseMaterialMapFromData, retrieveAcceptedFormats, retrieveActivityAnswerFromAnswerList, retrieveActivityCountOptionList, retrieveActivityMethodologyOptionList, retrieveActivityTemplateDTOOptionList, retrieveAllEarnedBadgeDTOListByCoterieType, retrieveAllEarnedBadgeDTOListByCoterieTypeList, retrieveAnnouncementAudienceOptionList, retrieveAnnouncementTypeOptionList, retrieveBadgeRuleListByParams, retrieveBadgeRuleTextByParams, retrieveBranchDTOByUserProfileOptionList, retrieveBranchDTOOptionList, retrieveBrandDTOByUserProfileOptionList, retrieveBrandDTOOptionList, retrieveCampusDTOByUserProfileOptionList, retrieveCampusDTOOptionList, retrieveCategoryVersionCodeOptionList, retrieveClockTimeLeft, retrieveColorByScore, retrieveContentTypeOptionList, retrieveContestTypeOptionList, retrieveCoterieTypeFromStandardExamCoterieType, retrieveCoterieTypeOptionList, retrieveCountryCodeOptionList, retrieveCountryNameOptionList, retrieveCurrencyTypeOptionList, retrieveCurrentDefaultDataMap, retrieveCurriculumTypeOptionList, retrieveDateIntervalOptionList, retrieveDefaultUserRoleOptionList, retrieveDelayTypeOptionList, retrieveDifficultyByActivityTypeFromData, retrieveDifficultyOptionList, retrieveDiscountAmountTypeOptionList, retrieveDistinctCoterieTypeFromCorporatePersonalizedAssignmentApplicationDTO, retrieveDurationInMinutesOptionList, retrieveDurationInSecondsOptionList, retrieveDurationTypeOptionList, retrieveEachTimeSpentInSeconds, retrieveEnableOptionList, retrieveExternalRegistrationDTOOptionList, retrieveFileTypeFromAcceptedFormat, retrieveFileTypeFromExtension, retrieveFileTypeOptionList, retrieveFrequencyTypeOptionList, retrieveGenderOptionList, retrieveGradeDTOByUserProfileOptionList, retrieveGradeDTOOptionList, retrieveGradeLevelOptionList, retrieveInstitutionDTOByUserProfileOptionList, retrieveInstitutionDTOOptionList, retrieveInstitutionTypeByLevel, retrieveInstitutionTypeOptionList, retrieveLanguageOptionList, retrieveLastNOptionList, retrieveLeagueThresholdByLeagueType, retrieveLeagueThresholds, retrieveLeagueTypeOptionList, retrieveMonthNameByIndex, retrieveOpticalExamPartTypeOptionList, retrieveOpticalExamTypeOptionList, retrieveOtherBadgeDTOList, retrieveOutcomePlanTypeOptionList, retrievePhoneNumberAreaCodeList, retrieveProvinceNameOptionList, retrieveReportTypeOptionList, retrieveSeasonDTOByUserProfileOptionList, retrieveSeasonDTOOptionList, retrieveSkillVersionCodeOptionList, retrieveStandardExamCoterieTypeOptionListByStandardExamType, retrieveStandardExamTypeIcon, retrieveStandardExamTypeOptionList, retrieveStatusOptionList, retrieveTeachingMethodologyOptionList, retrieveTimeFilterOptionList, retrieveTimeFilterWithLastNOptionList, retrieveTokenUsageSubTypeOptionList, retrieveTokenUsageTypeOptionList, retrieveTotalTimeSpentInMinutes, retrieveTotalTimeSpentInSeconds, retrieveUserAuthorityGeneralOptionList, retrieveUserRoleOptionList, retrieveValidationRequirementList, shuffleArray, useScreenSize };
960
+ export { ActivityBodyContent, ActivityEmptyContent, ActivityEvaluationRubricContent, ActivityPreviewByData, ActivitySolutionContent, AmberLabel, ApproveButton, BaseCard, BaseImage, BaseLoading, BaseLoadingWithText, BaseModal, BasePDF, BaseTitle, BlueLabel, BlueVerticalDividerLine, CancelButton, CoralLabel, CreateButton, CyanLabel, DeleteButton, DividerLine, DropdownActivityContent, FillInTheBlanksActivityContent, FullCard, GrayLabel, GreenLabel, GroupingActivityContent, InfoWithText, InputGroup, InputWithSpecialExpression, LeftTextRightInputGroup, LimeLabel, MCMAActivityContent, MCSAActivityContent, MatchingActivityContent, ONE_DAY, ONE_HOUR, ONE_MONTH, ONE_WEEK, OpenEndedActivityContent, OrangeLabel, OrderingActivityContent, PageTravelGroup, PrimaryButton, ProgressBar, PurpleLabel, RedLabel, ScoreBar, SecondaryButton, SelectionBox, SelectionCheckbox, SelectionTab, SelectionTabFill, SelectionTabPill, StartButton, StatusError, SubTitle, THREE_MONTHS, TealLabel, TimedProgressBar, TrueFalseActivityContent, VerticalDividerLine, base64ToFile, calculateEndDateOfWeek, calculateLevenshteinDistance, calculateStartDateOfWeek, checkActivityAnswerState, checkAnswerState, checkIsActivityAnswerFullyCorrect, constructActivityAnswerMap, constructActivityAnswerStateList, constructActivityData, constructActivityItemListBodyOnly, constructActivityItemListForSolution, constructActivityItemListMaterialOnly, constructActivityItemListSolutionOnly, constructActivityItemListWithAnswersForAI, constructActivityItemListWithSolutionForAI, constructAnswerBasedOnData, constructBaseNumericIndividualModel, constructBaseVerbalIndvidualModel, constructCategoryTreeFromParentCode, constructCombinedCorporateAssessmentAssignmentReportMap, constructCombinedOutcomeActivityScoreMapFromCombinedReport, constructInputWithSpecialExpressionList, constructMonthName, constructOutcomeActivityScoreList, constructUserProfileQueryParams, constructWeekName, convertDataURLtoFile, convertToBase64, convertToBodyMapString, convertToEvaluationRubricMapString, convertToSolutionMapString, convertTurkishCharactersToEnglish, decodeJWT, encodeJWT, filterCategoryVersionCodeOptionList, filterCategoryVersionCodeOptionListByGradeDTO, filterCategoryVersionCodeOptionListByInstitutionDTO, filterCoterieTypeByDistinctOptionList, filterCoterieTypeOptionList, filterCurriculumTypeOptionList, filterGradeLevelOptionList, filterSkillVersionCodeOptionList, filterUserRoleOptionList, findAISettingsFromCurrentProfile, findBestFitActivity, formatPriceWithCommas, getColorByIndex, getCurrentDateTime, getLanguageFromCode, getLanguageFromCurriculumType, getOneWeekLater, getSystemLanguageFromCurriculumType, ignoreMathematicalExpression, mergeObjects, parseBodyMapFromData, parseContentMapFromData, parseMaterialMapFromData, retrieveAcceptedFormats, retrieveActivityAnswerFromAnswerList, retrieveActivityCountOptionList, retrieveActivityMethodologyOptionList, retrieveActivityTemplateDTOOptionList, retrieveAllEarnedBadgeDTOListByCoterieType, retrieveAllEarnedBadgeDTOListByCoterieTypeList, retrieveAnnouncementAudienceOptionList, retrieveAnnouncementTypeOptionList, retrieveBadgeRuleListByParams, retrieveBadgeRuleTextByParams, retrieveBranchDTOByUserProfileOptionList, retrieveBranchDTOOptionList, retrieveBrandDTOByUserProfileOptionList, retrieveBrandDTOOptionList, retrieveCampusDTOByUserProfileOptionList, retrieveCampusDTOOptionList, retrieveCategoryVersionCodeOptionList, retrieveClockTimeLeft, retrieveColorByScore, retrieveContentTypeOptionList, retrieveContestTypeOptionList, retrieveCoterieTypeFromStandardExamCoterieType, retrieveCoterieTypeOptionList, retrieveCountryCodeOptionList, retrieveCountryNameOptionList, retrieveCurrencyTypeOptionList, retrieveCurrentDefaultDataMap, retrieveCurriculumTypeOptionList, retrieveDateIntervalOptionList, retrieveDefaultUserRoleOptionList, retrieveDelayTypeOptionList, retrieveDifficultyByActivityTypeFromData, retrieveDifficultyOptionList, retrieveDiscountAmountTypeOptionList, retrieveDistinctCoterieTypeFromCorporatePersonalizedAssignmentApplicationDTO, retrieveDurationInMinutesOptionList, retrieveDurationInSecondsOptionList, retrieveDurationTypeOptionList, retrieveEachTimeSpentInSeconds, retrieveEnableOptionList, retrieveExternalRegistrationDTOOptionList, retrieveFileTypeFromAcceptedFormat, retrieveFileTypeFromExtension, retrieveFileTypeOptionList, retrieveFrequencyTypeOptionList, retrieveGenderOptionList, retrieveGradeDTOByUserProfileOptionList, retrieveGradeDTOOptionList, retrieveGradeLevelOptionList, retrieveInstitutionDTOByUserProfileOptionList, retrieveInstitutionDTOOptionList, retrieveInstitutionTypeByLevel, retrieveInstitutionTypeOptionList, retrieveLanguageOptionList, retrieveLastNOptionList, retrieveLeagueThresholdByLeagueType, retrieveLeagueThresholds, retrieveLeagueTypeOptionList, retrieveMonthNameByIndex, retrieveOpticalExamPartTypeOptionList, retrieveOpticalExamTypeOptionList, retrieveOtherBadgeDTOList, retrieveOutcomePlanTypeOptionList, retrievePhoneNumberAreaCodeList, retrieveProvinceNameOptionList, retrieveReportTypeOptionList, retrieveSeasonDTOByUserProfileOptionList, retrieveSeasonDTOOptionList, retrieveSkillVersionCodeOptionList, retrieveStandardExamCoterieTypeOptionListByStandardExamType, retrieveStandardExamTypeIcon, retrieveStandardExamTypeOptionList, retrieveStatusOptionList, retrieveTeachingMethodologyOptionList, retrieveTimeFilterOptionList, retrieveTimeFilterWithLastNOptionList, retrieveTokenUsageSubTypeOptionList, retrieveTokenUsageTypeOptionList, retrieveTotalTimeSpentInMinutes, retrieveTotalTimeSpentInSeconds, retrieveUserAuthorityGeneralOptionList, retrieveUserRoleOptionList, retrieveValidationRequirementList, shuffleArray, useScreenSize };
package/dist/index.d.ts CHANGED
@@ -603,6 +603,8 @@ declare const retrieveActivityCountOptionList: () => {
603
603
  value: number;
604
604
  text: number;
605
605
  }[];
606
+ declare const checkAnswerState: (correctAnswer: any, learnerAnswer: any) => string;
607
+ declare const checkIsActivityAnswerFullyCorrect: (activityTemplateType: string, answerMap: any, activityData: any) => any;
606
608
 
607
609
  declare const retrieveCurriculumTypeOptionList: () => {
608
610
  value: string;
@@ -955,4 +957,4 @@ declare const retrieveActivityMethodologyOptionList: () => {
955
957
  text: string;
956
958
  }[];
957
959
 
958
- export { ActivityBodyContent, ActivityEmptyContent, ActivityEvaluationRubricContent, ActivityPreviewByData, ActivitySolutionContent, AmberLabel, ApproveButton, BaseCard, BaseImage, BaseLoading, BaseLoadingWithText, BaseModal, BasePDF, BaseTitle, BlueLabel, BlueVerticalDividerLine, CancelButton, CoralLabel, CreateButton, CyanLabel, DeleteButton, DividerLine, DropdownActivityContent, FillInTheBlanksActivityContent, FullCard, GrayLabel, GreenLabel, GroupingActivityContent, InfoWithText, InputGroup, InputWithSpecialExpression, LeftTextRightInputGroup, LimeLabel, MCMAActivityContent, MCSAActivityContent, MatchingActivityContent, ONE_DAY, ONE_HOUR, ONE_MONTH, ONE_WEEK, OpenEndedActivityContent, OrangeLabel, OrderingActivityContent, PageTravelGroup, PrimaryButton, ProgressBar, PurpleLabel, RedLabel, ScoreBar, SecondaryButton, SelectionBox, SelectionCheckbox, SelectionTab, SelectionTabFill, SelectionTabPill, StartButton, StatusError, SubTitle, THREE_MONTHS, TealLabel, TimedProgressBar, TrueFalseActivityContent, VerticalDividerLine, base64ToFile, calculateEndDateOfWeek, calculateLevenshteinDistance, calculateStartDateOfWeek, checkActivityAnswerState, constructActivityAnswerMap, constructActivityAnswerStateList, constructActivityData, constructActivityItemListBodyOnly, constructActivityItemListForSolution, constructActivityItemListMaterialOnly, constructActivityItemListSolutionOnly, constructActivityItemListWithAnswersForAI, constructActivityItemListWithSolutionForAI, constructAnswerBasedOnData, constructBaseNumericIndividualModel, constructBaseVerbalIndvidualModel, constructCategoryTreeFromParentCode, constructCombinedCorporateAssessmentAssignmentReportMap, constructCombinedOutcomeActivityScoreMapFromCombinedReport, constructInputWithSpecialExpressionList, constructMonthName, constructOutcomeActivityScoreList, constructUserProfileQueryParams, constructWeekName, convertDataURLtoFile, convertToBase64, convertToBodyMapString, convertToEvaluationRubricMapString, convertToSolutionMapString, convertTurkishCharactersToEnglish, decodeJWT, encodeJWT, filterCategoryVersionCodeOptionList, filterCategoryVersionCodeOptionListByGradeDTO, filterCategoryVersionCodeOptionListByInstitutionDTO, filterCoterieTypeByDistinctOptionList, filterCoterieTypeOptionList, filterCurriculumTypeOptionList, filterGradeLevelOptionList, filterSkillVersionCodeOptionList, filterUserRoleOptionList, findAISettingsFromCurrentProfile, findBestFitActivity, formatPriceWithCommas, getColorByIndex, getCurrentDateTime, getLanguageFromCode, getLanguageFromCurriculumType, getOneWeekLater, getSystemLanguageFromCurriculumType, ignoreMathematicalExpression, mergeObjects, parseBodyMapFromData, parseContentMapFromData, parseMaterialMapFromData, retrieveAcceptedFormats, retrieveActivityAnswerFromAnswerList, retrieveActivityCountOptionList, retrieveActivityMethodologyOptionList, retrieveActivityTemplateDTOOptionList, retrieveAllEarnedBadgeDTOListByCoterieType, retrieveAllEarnedBadgeDTOListByCoterieTypeList, retrieveAnnouncementAudienceOptionList, retrieveAnnouncementTypeOptionList, retrieveBadgeRuleListByParams, retrieveBadgeRuleTextByParams, retrieveBranchDTOByUserProfileOptionList, retrieveBranchDTOOptionList, retrieveBrandDTOByUserProfileOptionList, retrieveBrandDTOOptionList, retrieveCampusDTOByUserProfileOptionList, retrieveCampusDTOOptionList, retrieveCategoryVersionCodeOptionList, retrieveClockTimeLeft, retrieveColorByScore, retrieveContentTypeOptionList, retrieveContestTypeOptionList, retrieveCoterieTypeFromStandardExamCoterieType, retrieveCoterieTypeOptionList, retrieveCountryCodeOptionList, retrieveCountryNameOptionList, retrieveCurrencyTypeOptionList, retrieveCurrentDefaultDataMap, retrieveCurriculumTypeOptionList, retrieveDateIntervalOptionList, retrieveDefaultUserRoleOptionList, retrieveDelayTypeOptionList, retrieveDifficultyByActivityTypeFromData, retrieveDifficultyOptionList, retrieveDiscountAmountTypeOptionList, retrieveDistinctCoterieTypeFromCorporatePersonalizedAssignmentApplicationDTO, retrieveDurationInMinutesOptionList, retrieveDurationInSecondsOptionList, retrieveDurationTypeOptionList, retrieveEachTimeSpentInSeconds, retrieveEnableOptionList, retrieveExternalRegistrationDTOOptionList, retrieveFileTypeFromAcceptedFormat, retrieveFileTypeFromExtension, retrieveFileTypeOptionList, retrieveFrequencyTypeOptionList, retrieveGenderOptionList, retrieveGradeDTOByUserProfileOptionList, retrieveGradeDTOOptionList, retrieveGradeLevelOptionList, retrieveInstitutionDTOByUserProfileOptionList, retrieveInstitutionDTOOptionList, retrieveInstitutionTypeByLevel, retrieveInstitutionTypeOptionList, retrieveLanguageOptionList, retrieveLastNOptionList, retrieveLeagueThresholdByLeagueType, retrieveLeagueThresholds, retrieveLeagueTypeOptionList, retrieveMonthNameByIndex, retrieveOpticalExamPartTypeOptionList, retrieveOpticalExamTypeOptionList, retrieveOtherBadgeDTOList, retrieveOutcomePlanTypeOptionList, retrievePhoneNumberAreaCodeList, retrieveProvinceNameOptionList, retrieveReportTypeOptionList, retrieveSeasonDTOByUserProfileOptionList, retrieveSeasonDTOOptionList, retrieveSkillVersionCodeOptionList, retrieveStandardExamCoterieTypeOptionListByStandardExamType, retrieveStandardExamTypeIcon, retrieveStandardExamTypeOptionList, retrieveStatusOptionList, retrieveTeachingMethodologyOptionList, retrieveTimeFilterOptionList, retrieveTimeFilterWithLastNOptionList, retrieveTokenUsageSubTypeOptionList, retrieveTokenUsageTypeOptionList, retrieveTotalTimeSpentInMinutes, retrieveTotalTimeSpentInSeconds, retrieveUserAuthorityGeneralOptionList, retrieveUserRoleOptionList, retrieveValidationRequirementList, shuffleArray, useScreenSize };
960
+ export { ActivityBodyContent, ActivityEmptyContent, ActivityEvaluationRubricContent, ActivityPreviewByData, ActivitySolutionContent, AmberLabel, ApproveButton, BaseCard, BaseImage, BaseLoading, BaseLoadingWithText, BaseModal, BasePDF, BaseTitle, BlueLabel, BlueVerticalDividerLine, CancelButton, CoralLabel, CreateButton, CyanLabel, DeleteButton, DividerLine, DropdownActivityContent, FillInTheBlanksActivityContent, FullCard, GrayLabel, GreenLabel, GroupingActivityContent, InfoWithText, InputGroup, InputWithSpecialExpression, LeftTextRightInputGroup, LimeLabel, MCMAActivityContent, MCSAActivityContent, MatchingActivityContent, ONE_DAY, ONE_HOUR, ONE_MONTH, ONE_WEEK, OpenEndedActivityContent, OrangeLabel, OrderingActivityContent, PageTravelGroup, PrimaryButton, ProgressBar, PurpleLabel, RedLabel, ScoreBar, SecondaryButton, SelectionBox, SelectionCheckbox, SelectionTab, SelectionTabFill, SelectionTabPill, StartButton, StatusError, SubTitle, THREE_MONTHS, TealLabel, TimedProgressBar, TrueFalseActivityContent, VerticalDividerLine, base64ToFile, calculateEndDateOfWeek, calculateLevenshteinDistance, calculateStartDateOfWeek, checkActivityAnswerState, checkAnswerState, checkIsActivityAnswerFullyCorrect, constructActivityAnswerMap, constructActivityAnswerStateList, constructActivityData, constructActivityItemListBodyOnly, constructActivityItemListForSolution, constructActivityItemListMaterialOnly, constructActivityItemListSolutionOnly, constructActivityItemListWithAnswersForAI, constructActivityItemListWithSolutionForAI, constructAnswerBasedOnData, constructBaseNumericIndividualModel, constructBaseVerbalIndvidualModel, constructCategoryTreeFromParentCode, constructCombinedCorporateAssessmentAssignmentReportMap, constructCombinedOutcomeActivityScoreMapFromCombinedReport, constructInputWithSpecialExpressionList, constructMonthName, constructOutcomeActivityScoreList, constructUserProfileQueryParams, constructWeekName, convertDataURLtoFile, convertToBase64, convertToBodyMapString, convertToEvaluationRubricMapString, convertToSolutionMapString, convertTurkishCharactersToEnglish, decodeJWT, encodeJWT, filterCategoryVersionCodeOptionList, filterCategoryVersionCodeOptionListByGradeDTO, filterCategoryVersionCodeOptionListByInstitutionDTO, filterCoterieTypeByDistinctOptionList, filterCoterieTypeOptionList, filterCurriculumTypeOptionList, filterGradeLevelOptionList, filterSkillVersionCodeOptionList, filterUserRoleOptionList, findAISettingsFromCurrentProfile, findBestFitActivity, formatPriceWithCommas, getColorByIndex, getCurrentDateTime, getLanguageFromCode, getLanguageFromCurriculumType, getOneWeekLater, getSystemLanguageFromCurriculumType, ignoreMathematicalExpression, mergeObjects, parseBodyMapFromData, parseContentMapFromData, parseMaterialMapFromData, retrieveAcceptedFormats, retrieveActivityAnswerFromAnswerList, retrieveActivityCountOptionList, retrieveActivityMethodologyOptionList, retrieveActivityTemplateDTOOptionList, retrieveAllEarnedBadgeDTOListByCoterieType, retrieveAllEarnedBadgeDTOListByCoterieTypeList, retrieveAnnouncementAudienceOptionList, retrieveAnnouncementTypeOptionList, retrieveBadgeRuleListByParams, retrieveBadgeRuleTextByParams, retrieveBranchDTOByUserProfileOptionList, retrieveBranchDTOOptionList, retrieveBrandDTOByUserProfileOptionList, retrieveBrandDTOOptionList, retrieveCampusDTOByUserProfileOptionList, retrieveCampusDTOOptionList, retrieveCategoryVersionCodeOptionList, retrieveClockTimeLeft, retrieveColorByScore, retrieveContentTypeOptionList, retrieveContestTypeOptionList, retrieveCoterieTypeFromStandardExamCoterieType, retrieveCoterieTypeOptionList, retrieveCountryCodeOptionList, retrieveCountryNameOptionList, retrieveCurrencyTypeOptionList, retrieveCurrentDefaultDataMap, retrieveCurriculumTypeOptionList, retrieveDateIntervalOptionList, retrieveDefaultUserRoleOptionList, retrieveDelayTypeOptionList, retrieveDifficultyByActivityTypeFromData, retrieveDifficultyOptionList, retrieveDiscountAmountTypeOptionList, retrieveDistinctCoterieTypeFromCorporatePersonalizedAssignmentApplicationDTO, retrieveDurationInMinutesOptionList, retrieveDurationInSecondsOptionList, retrieveDurationTypeOptionList, retrieveEachTimeSpentInSeconds, retrieveEnableOptionList, retrieveExternalRegistrationDTOOptionList, retrieveFileTypeFromAcceptedFormat, retrieveFileTypeFromExtension, retrieveFileTypeOptionList, retrieveFrequencyTypeOptionList, retrieveGenderOptionList, retrieveGradeDTOByUserProfileOptionList, retrieveGradeDTOOptionList, retrieveGradeLevelOptionList, retrieveInstitutionDTOByUserProfileOptionList, retrieveInstitutionDTOOptionList, retrieveInstitutionTypeByLevel, retrieveInstitutionTypeOptionList, retrieveLanguageOptionList, retrieveLastNOptionList, retrieveLeagueThresholdByLeagueType, retrieveLeagueThresholds, retrieveLeagueTypeOptionList, retrieveMonthNameByIndex, retrieveOpticalExamPartTypeOptionList, retrieveOpticalExamTypeOptionList, retrieveOtherBadgeDTOList, retrieveOutcomePlanTypeOptionList, retrievePhoneNumberAreaCodeList, retrieveProvinceNameOptionList, retrieveReportTypeOptionList, retrieveSeasonDTOByUserProfileOptionList, retrieveSeasonDTOOptionList, retrieveSkillVersionCodeOptionList, retrieveStandardExamCoterieTypeOptionListByStandardExamType, retrieveStandardExamTypeIcon, retrieveStandardExamTypeOptionList, retrieveStatusOptionList, retrieveTeachingMethodologyOptionList, retrieveTimeFilterOptionList, retrieveTimeFilterWithLastNOptionList, retrieveTokenUsageSubTypeOptionList, retrieveTokenUsageTypeOptionList, retrieveTotalTimeSpentInMinutes, retrieveTotalTimeSpentInSeconds, retrieveUserAuthorityGeneralOptionList, retrieveUserRoleOptionList, retrieveValidationRequirementList, shuffleArray, useScreenSize };
package/dist/index.js CHANGED
@@ -135,6 +135,8 @@ __export(index_exports, {
135
135
  calculateLevenshteinDistance: () => calculateLevenshteinDistance,
136
136
  calculateStartDateOfWeek: () => calculateStartDateOfWeek,
137
137
  checkActivityAnswerState: () => checkActivityAnswerState,
138
+ checkAnswerState: () => checkAnswerState,
139
+ checkIsActivityAnswerFullyCorrect: () => checkIsActivityAnswerFullyCorrect,
138
140
  constructActivityAnswerMap: () => constructActivityAnswerMap,
139
141
  constructActivityAnswerStateList: () => constructActivityAnswerStateList,
140
142
  constructActivityData: () => constructActivityData,
@@ -3431,6 +3433,88 @@ var retrieveActivityCountOptionList = () => {
3431
3433
  }
3432
3434
  ];
3433
3435
  };
3436
+ var checkAnswerState = (correctAnswer, learnerAnswer) => {
3437
+ if (Array.isArray(correctAnswer)) {
3438
+ return correctAnswer.some((ca) => ca === learnerAnswer) ? "CORRECT" : "INCORRECT";
3439
+ }
3440
+ return correctAnswer === learnerAnswer ? "CORRECT" : "INCORRECT";
3441
+ };
3442
+ var checkIsActivityAnswerFullyCorrect = (activityTemplateType, answerMap, activityData) => {
3443
+ if (!answerMap || !activityData) return false;
3444
+ if (activityTemplateType === "OPEN_ENDED") return false;
3445
+ const materialMap = parseMaterialMapFromData(
3446
+ activityData,
3447
+ activityTemplateType
3448
+ );
3449
+ if (!materialMap) return false;
3450
+ if (activityTemplateType === "MCSA") {
3451
+ const correctAnswer = Object.keys(materialMap)[0];
3452
+ return Object.keys(answerMap).every(
3453
+ (key) => checkAnswerState(correctAnswer, answerMap[key]) === "CORRECT"
3454
+ );
3455
+ }
3456
+ if (activityTemplateType === "MCMA") {
3457
+ const correctAnswerList = JSON.parse(Object.keys(materialMap)[0]);
3458
+ return Object.keys(answerMap).every((key) => {
3459
+ const learnerAnswers = answerMap[key];
3460
+ if (!Array.isArray(learnerAnswers)) return false;
3461
+ if (learnerAnswers.length !== correctAnswerList.length) return false;
3462
+ return learnerAnswers.every(
3463
+ (la) => checkAnswerState(correctAnswerList, la) === "CORRECT"
3464
+ );
3465
+ });
3466
+ }
3467
+ if (activityTemplateType === "TRUE_FALSE") {
3468
+ const correctTrueList = materialMap.trueList || [];
3469
+ const correctFalseList = materialMap.falseList || [];
3470
+ const learnerTrueList = answerMap.trueList || [];
3471
+ const learnerFalseList = answerMap.falseList || [];
3472
+ if (learnerTrueList.length !== correctTrueList.length) return false;
3473
+ if (learnerFalseList.length !== correctFalseList.length) return false;
3474
+ const allTrueCorrect = correctTrueList.every(
3475
+ (item) => checkAnswerState(correctTrueList, item) === "CORRECT" && learnerTrueList.includes(item)
3476
+ );
3477
+ const allFalseCorrect = correctFalseList.every(
3478
+ (item) => checkAnswerState(correctFalseList, item) === "CORRECT" && learnerFalseList.includes(item)
3479
+ );
3480
+ return allTrueCorrect && allFalseCorrect;
3481
+ }
3482
+ if (activityTemplateType === "ORDERING") {
3483
+ return Object.keys(answerMap).every(
3484
+ (key, index) => checkAnswerState(index + "", answerMap[key] + "") === "CORRECT"
3485
+ );
3486
+ }
3487
+ if (activityTemplateType === "DROPDOWN") {
3488
+ return Object.keys(materialMap).every((key) => {
3489
+ const correctAnswer = Object.keys(materialMap[key])[0];
3490
+ return checkAnswerState(correctAnswer, answerMap[key]) === "CORRECT";
3491
+ });
3492
+ }
3493
+ if (activityTemplateType === "MATCHING") {
3494
+ return Object.keys(materialMap).every(
3495
+ (key) => checkAnswerState(materialMap[key], answerMap[key]) === "CORRECT"
3496
+ );
3497
+ }
3498
+ if (activityTemplateType === "GROUPING") {
3499
+ return Object.keys(materialMap).every((key) => {
3500
+ const correctItems = materialMap[key];
3501
+ const learnerItems = answerMap[key] || [];
3502
+ if (!Array.isArray(correctItems) || !Array.isArray(learnerItems))
3503
+ return false;
3504
+ if (correctItems.length !== learnerItems.length) return false;
3505
+ return learnerItems.every(
3506
+ (item) => checkAnswerState(correctItems, item) === "CORRECT"
3507
+ );
3508
+ });
3509
+ }
3510
+ if (activityTemplateType === "FILL_IN_THE_BLANKS") {
3511
+ return Object.keys(materialMap).every((key) => {
3512
+ const acceptableAnswers = JSON.parse(materialMap[key]);
3513
+ return checkAnswerState(acceptableAnswers, answerMap[key]) === "CORRECT";
3514
+ });
3515
+ }
3516
+ return false;
3517
+ };
3434
3518
 
3435
3519
  // src/components/activities/body-contents/ShowBodyMediaByContentType.tsx
3436
3520
  var import_react_katex = require("react-katex");
@@ -4771,23 +4855,13 @@ var DropdownActivityMaterialContent = ({
4771
4855
  setDisplayAnswerMap(answerMap);
4772
4856
  }
4773
4857
  }, [showCorrectAnswer, answerMap, materialMap]);
4774
- const checkAnswerState = (correctAnswer, learnerAnswer) => {
4775
- if (!isPreview) return null;
4776
- if (correctAnswer === learnerAnswer) {
4777
- return "CORRECT";
4778
- }
4779
- return "INCORRECT";
4780
- };
4781
4858
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col h-full", children: [
4782
4859
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "hidden md:block flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "font-semibold text-xl opacity-60", children: i18n_default.t("please_select_dropdown_text") }) }),
4783
4860
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "hidden md:block flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DividerLine_default, {}) }),
4784
4861
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex-1 min-h-0 overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "w-full flex flex-row flex-wrap", children: Object.keys(displayAnswerMap).map(
4785
4862
  (materialKey, index) => {
4786
4863
  const answerKey = Object.keys(materialMap[materialKey])[0];
4787
- const learnerAnswerState = checkAnswerState(
4788
- answerKey,
4789
- displayAnswerMap[materialKey]
4790
- );
4864
+ const learnerAnswerState = !isPreview ? null : checkAnswerState(answerKey, displayAnswerMap[materialKey]);
4791
4865
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "w-full md:w-1/2", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "mx-2", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "w-full flex flex-row my-2 gap-x-2", children: [
4792
4866
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "my-auto", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("p", { className: "text-xl", children: [
4793
4867
  parseFloat(materialKey) + 1,
@@ -5031,16 +5105,6 @@ var FillInTheBlanksActivityMaterialContent = ({
5031
5105
  setDisplayAnswerMap(answerMap);
5032
5106
  }
5033
5107
  }, [showCorrectAnswer, answerMap, materialMap]);
5034
- const checkAnswerState = (correctAnswerList, learnerAnswer) => {
5035
- if (!isPreview) return null;
5036
- const foundIndex = correctAnswerList.findIndex(
5037
- (correctAnswer) => correctAnswer === learnerAnswer
5038
- );
5039
- if (foundIndex !== -1) {
5040
- return "CORRECT";
5041
- }
5042
- return "INCORRECT";
5043
- };
5044
5108
  const checkAnswerProvided = (currentAnswerMap, option) => {
5045
5109
  return Object.keys(currentAnswerMap).findIndex(
5046
5110
  (key) => currentAnswerMap[key] === option
@@ -5231,7 +5295,7 @@ var FillInTheBlanksActivityMaterialContent = ({
5231
5295
  )
5232
5296
  ) }),
5233
5297
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "w-full flex flex-row flex-wrap", children: Object.keys(displayAnswerMap).map((materialKey, index) => {
5234
- const learnerAnswerState = checkAnswerState(
5298
+ const learnerAnswerState = !isPreview ? null : checkAnswerState(
5235
5299
  JSON.parse(materialMap[materialKey]),
5236
5300
  displayAnswerMap[materialKey]
5237
5301
  );
@@ -5533,18 +5597,6 @@ var GroupingActivityMaterialContent = ({
5533
5597
  (material) => selectedValueList.findIndex((value) => material === value) === -1
5534
5598
  );
5535
5599
  };
5536
- const checkAnswerState = (correctAnswerList, learnerAnswer) => {
5537
- if (!isPreview) return null;
5538
- if (!learnerAnswer) return "EMPTY";
5539
- if (!correctAnswerList) return "EMPTY";
5540
- const foundIndex = correctAnswerList.findIndex(
5541
- (correctAnswer) => correctAnswer === learnerAnswer
5542
- );
5543
- if (foundIndex !== -1) {
5544
- return "CORRECT";
5545
- }
5546
- return "INCORRECT";
5547
- };
5548
5600
  const handleMouseDown = (e, materialValue) => {
5549
5601
  if (!checkCanAnswerQuestion()) return;
5550
5602
  e.preventDefault();
@@ -5749,10 +5801,7 @@ var GroupingActivityMaterialContent = ({
5749
5801
  className: `${dropTargetKey === answerMapKey ? "bg-catchup-light-blue ring-2 ring-blue-400" : ""} flex-1 border-catchup-blue rounded-catchup-xlarge border-2 h-full p-1 transition-all duration-200`,
5750
5802
  children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "h-full w-full overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex flex-row items-center gap-2 w-max h-full", children: displayAnswerMap[answerMapKey].map(
5751
5803
  (answerMapValue, answerMapIndex) => {
5752
- const learnerAnswerState = checkAnswerState(
5753
- materialMap[answerMapKey],
5754
- answerMapValue
5755
- );
5804
+ const learnerAnswerState = !isPreview ? null : !answerMapValue ? "EMPTY" : !materialMap[answerMapKey] ? "EMPTY" : checkAnswerState(materialMap[answerMapKey], answerMapValue);
5756
5805
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "p-1", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
5757
5806
  "div",
5758
5807
  {
@@ -5992,14 +6041,6 @@ var MatchingActivityMaterialContent = ({
5992
6041
  (material) => selectedValueList.findIndex((value) => material === value) === -1
5993
6042
  );
5994
6043
  };
5995
- const checkAnswerState = (correctAnswer, learnerAnswer) => {
5996
- if (!isPreview) return null;
5997
- if (!learnerAnswer) return "EMPTY";
5998
- if (correctAnswer === learnerAnswer) {
5999
- return "CORRECT";
6000
- }
6001
- return "INCORRECT";
6002
- };
6003
6044
  const handleMouseDown = (e, materialValue) => {
6004
6045
  if (!checkCanAnswerQuestion()) return;
6005
6046
  e.preventDefault();
@@ -6181,10 +6222,7 @@ var MatchingActivityMaterialContent = ({
6181
6222
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DividerLine_default, {}) })
6182
6223
  ] }) : null,
6183
6224
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex-1 min-h-0 overflow-y-auto", children: Object.keys(displayAnswerMap).map((answerMapKey, index) => {
6184
- const learnerAnswerState = checkAnswerState(
6185
- materialMap[answerMapKey],
6186
- displayAnswerMap[answerMapKey]
6187
- );
6225
+ const learnerAnswerState = !isPreview ? null : !displayAnswerMap[answerMapKey] ? "EMPTY" : checkAnswerState(materialMap[answerMapKey], displayAnswerMap[answerMapKey]);
6188
6226
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-row w-full", children: [
6189
6227
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "w-1/3", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6190
6228
  "div",
@@ -6338,17 +6376,6 @@ var MCMAActivityMaterialContent = ({
6338
6376
  const retrieveCorrectAnswerList = () => {
6339
6377
  return JSON.parse(Object.keys(materialMap)[0]);
6340
6378
  };
6341
- const checkAnswerState = (correctAnswerList2, currentAnswer, learnerAnswer) => {
6342
- if (!isPreview) return "HIDDEN";
6343
- if (currentAnswer !== learnerAnswer) return "EMPTY";
6344
- const foundIndex = correctAnswerList2.findIndex(
6345
- (correctAnswer) => correctAnswer === learnerAnswer
6346
- );
6347
- if (foundIndex !== -1) {
6348
- return "CORRECT";
6349
- }
6350
- return "INCORRECT";
6351
- };
6352
6379
  const correctAnswerList = retrieveCorrectAnswerList();
6353
6380
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "flex flex-col h-full", children: Object.keys(materialMap).map((materialKey, index) => {
6354
6381
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "flex flex-col flex-1 min-h-0", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex-1 flex flex-col border-catchup-lighter-gray rounded-catchup-xlarge px-5 md:px-0 min-h-0", children: [
@@ -6359,11 +6386,7 @@ var MCMAActivityMaterialContent = ({
6359
6386
  const foundAnswer = displayAnswerMap[materialKey].find(
6360
6387
  (learnerAnswer) => learnerAnswer === materialSubKey
6361
6388
  );
6362
- const learnerAnswerState = checkAnswerState(
6363
- correctAnswerList,
6364
- materialSubKey,
6365
- foundAnswer
6366
- );
6389
+ const learnerAnswerState = !isPreview ? "HIDDEN" : materialSubKey !== foundAnswer ? "EMPTY" : checkAnswerState(correctAnswerList, foundAnswer);
6367
6390
  const foundIndex = correctAnswerList.findIndex(
6368
6391
  (correctAnswer) => correctAnswer === materialSubKey
6369
6392
  );
@@ -6496,14 +6519,6 @@ var MCSAActivityMaterialContent = ({
6496
6519
  const retrieveCorrectAnswer = () => {
6497
6520
  return Object.keys(materialMap)[0];
6498
6521
  };
6499
- const checkAnswerState = (correctAnswer2, currentAnswer, learnerAnswer) => {
6500
- if (!isPreview) return "HIDDEN";
6501
- if (currentAnswer !== learnerAnswer) return "EMPTY";
6502
- if (correctAnswer2 === learnerAnswer) {
6503
- return "CORRECT";
6504
- }
6505
- return "INCORRECT";
6506
- };
6507
6522
  const correctAnswer = retrieveCorrectAnswer();
6508
6523
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "flex flex-col h-full", children: Object.keys(materialMap).map((materialKey, index) => {
6509
6524
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "flex flex-col flex-1 min-h-0", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex-1 flex flex-col border-catchup-lighter-gray rounded-catchup-xlarge px-5 md:px-0 min-h-0", children: [
@@ -6515,11 +6530,7 @@ var MCSAActivityMaterialContent = ({
6515
6530
  className: `flex flex-row w-full ${Object.keys(materialMap[materialKey]).length <= 4 ? "justify-center" : ""} flex-wrap`,
6516
6531
  children: materialMap[materialKey].map(
6517
6532
  (materialSubKey, index2) => {
6518
- const learnerAnswerState = checkAnswerState(
6519
- correctAnswer,
6520
- materialSubKey,
6521
- displayAnswerMap[materialKey]
6522
- );
6533
+ const learnerAnswerState = !isPreview ? "HIDDEN" : materialSubKey !== displayAnswerMap[materialKey] ? "EMPTY" : checkAnswerState(correctAnswer, displayAnswerMap[materialKey]);
6523
6534
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
6524
6535
  "div",
6525
6536
  {
@@ -6926,13 +6937,6 @@ var OrderingActivityMaterialContent = ({
6926
6937
  setDisplayAnswerMap(answerMap);
6927
6938
  }
6928
6939
  }, [showCorrectAnswer, answerMap]);
6929
- const checkAnswerState = (correctAnswer, learnerAnswer) => {
6930
- if (!isPreview) return null;
6931
- if (correctAnswer === learnerAnswer) {
6932
- return "CORRECT";
6933
- }
6934
- return "INCORRECT";
6935
- };
6936
6940
  const handleMouseDown = (e, materialKey) => {
6937
6941
  if (!checkCanAnswerQuestion()) return;
6938
6942
  e.preventDefault();
@@ -7073,10 +7077,7 @@ var OrderingActivityMaterialContent = ({
7073
7077
  }
7074
7078
  ),
7075
7079
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "flex-1 min-h-0 overflow-y-auto", children: Object.keys(displayAnswerMap).map((materialKey, index) => {
7076
- const learnerAnswerState = checkAnswerState(
7077
- displayAnswerMap[materialKey] + "",
7078
- index + ""
7079
- );
7080
+ const learnerAnswerState = !isPreview ? null : checkAnswerState(displayAnswerMap[materialKey] + "", index + "");
7080
7081
  return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
7081
7082
  "div",
7082
7083
  {
@@ -7232,13 +7233,6 @@ var TrueFalseActivityMaterialContent = ({
7232
7233
  setDisplayAnswerMap(answerMap);
7233
7234
  }
7234
7235
  }, [showCorrectAnswer, materialMap, answerMap]);
7235
- const checkAnswerState = (correctAnswer, learnerAnswer) => {
7236
- if (!isPreview) return null;
7237
- if (correctAnswer === learnerAnswer) {
7238
- return "CORRECT";
7239
- }
7240
- return "INCORRECT";
7241
- };
7242
7236
  return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex flex-col h-full", children: [
7243
7237
  /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "hidden md:block flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "font-semibold text-xl opacity-60", children: i18n_default.t("please_select_true_false_text") }) }),
7244
7238
  /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "hidden md:block flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DividerLine_default, {}) }),
@@ -7253,10 +7247,7 @@ var TrueFalseActivityMaterialContent = ({
7253
7247
  const learnerAnswer = displayAnswerMap.trueList.find(
7254
7248
  (trueItem) => trueItem === shuffleOption
7255
7249
  ) !== void 0 ? "TRUE" : "FALSE";
7256
- const learnerAnswerState = checkAnswerState(
7257
- correctAnswer,
7258
- learnerAnswer
7259
- );
7250
+ const learnerAnswerState = !isPreview ? null : checkAnswerState(correctAnswer, learnerAnswer);
7260
7251
  return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
7261
7252
  "div",
7262
7253
  {
@@ -11185,6 +11176,8 @@ var retrieveActivityMethodologyOptionList = () => {
11185
11176
  calculateLevenshteinDistance,
11186
11177
  calculateStartDateOfWeek,
11187
11178
  checkActivityAnswerState,
11179
+ checkAnswerState,
11180
+ checkIsActivityAnswerFullyCorrect,
11188
11181
  constructActivityAnswerMap,
11189
11182
  constructActivityAnswerStateList,
11190
11183
  constructActivityData,
package/dist/index.mjs CHANGED
@@ -3193,6 +3193,88 @@ var retrieveActivityCountOptionList = () => {
3193
3193
  }
3194
3194
  ];
3195
3195
  };
3196
+ var checkAnswerState = (correctAnswer, learnerAnswer) => {
3197
+ if (Array.isArray(correctAnswer)) {
3198
+ return correctAnswer.some((ca) => ca === learnerAnswer) ? "CORRECT" : "INCORRECT";
3199
+ }
3200
+ return correctAnswer === learnerAnswer ? "CORRECT" : "INCORRECT";
3201
+ };
3202
+ var checkIsActivityAnswerFullyCorrect = (activityTemplateType, answerMap, activityData) => {
3203
+ if (!answerMap || !activityData) return false;
3204
+ if (activityTemplateType === "OPEN_ENDED") return false;
3205
+ const materialMap = parseMaterialMapFromData(
3206
+ activityData,
3207
+ activityTemplateType
3208
+ );
3209
+ if (!materialMap) return false;
3210
+ if (activityTemplateType === "MCSA") {
3211
+ const correctAnswer = Object.keys(materialMap)[0];
3212
+ return Object.keys(answerMap).every(
3213
+ (key) => checkAnswerState(correctAnswer, answerMap[key]) === "CORRECT"
3214
+ );
3215
+ }
3216
+ if (activityTemplateType === "MCMA") {
3217
+ const correctAnswerList = JSON.parse(Object.keys(materialMap)[0]);
3218
+ return Object.keys(answerMap).every((key) => {
3219
+ const learnerAnswers = answerMap[key];
3220
+ if (!Array.isArray(learnerAnswers)) return false;
3221
+ if (learnerAnswers.length !== correctAnswerList.length) return false;
3222
+ return learnerAnswers.every(
3223
+ (la) => checkAnswerState(correctAnswerList, la) === "CORRECT"
3224
+ );
3225
+ });
3226
+ }
3227
+ if (activityTemplateType === "TRUE_FALSE") {
3228
+ const correctTrueList = materialMap.trueList || [];
3229
+ const correctFalseList = materialMap.falseList || [];
3230
+ const learnerTrueList = answerMap.trueList || [];
3231
+ const learnerFalseList = answerMap.falseList || [];
3232
+ if (learnerTrueList.length !== correctTrueList.length) return false;
3233
+ if (learnerFalseList.length !== correctFalseList.length) return false;
3234
+ const allTrueCorrect = correctTrueList.every(
3235
+ (item) => checkAnswerState(correctTrueList, item) === "CORRECT" && learnerTrueList.includes(item)
3236
+ );
3237
+ const allFalseCorrect = correctFalseList.every(
3238
+ (item) => checkAnswerState(correctFalseList, item) === "CORRECT" && learnerFalseList.includes(item)
3239
+ );
3240
+ return allTrueCorrect && allFalseCorrect;
3241
+ }
3242
+ if (activityTemplateType === "ORDERING") {
3243
+ return Object.keys(answerMap).every(
3244
+ (key, index) => checkAnswerState(index + "", answerMap[key] + "") === "CORRECT"
3245
+ );
3246
+ }
3247
+ if (activityTemplateType === "DROPDOWN") {
3248
+ return Object.keys(materialMap).every((key) => {
3249
+ const correctAnswer = Object.keys(materialMap[key])[0];
3250
+ return checkAnswerState(correctAnswer, answerMap[key]) === "CORRECT";
3251
+ });
3252
+ }
3253
+ if (activityTemplateType === "MATCHING") {
3254
+ return Object.keys(materialMap).every(
3255
+ (key) => checkAnswerState(materialMap[key], answerMap[key]) === "CORRECT"
3256
+ );
3257
+ }
3258
+ if (activityTemplateType === "GROUPING") {
3259
+ return Object.keys(materialMap).every((key) => {
3260
+ const correctItems = materialMap[key];
3261
+ const learnerItems = answerMap[key] || [];
3262
+ if (!Array.isArray(correctItems) || !Array.isArray(learnerItems))
3263
+ return false;
3264
+ if (correctItems.length !== learnerItems.length) return false;
3265
+ return learnerItems.every(
3266
+ (item) => checkAnswerState(correctItems, item) === "CORRECT"
3267
+ );
3268
+ });
3269
+ }
3270
+ if (activityTemplateType === "FILL_IN_THE_BLANKS") {
3271
+ return Object.keys(materialMap).every((key) => {
3272
+ const acceptableAnswers = JSON.parse(materialMap[key]);
3273
+ return checkAnswerState(acceptableAnswers, answerMap[key]) === "CORRECT";
3274
+ });
3275
+ }
3276
+ return false;
3277
+ };
3196
3278
 
3197
3279
  // src/components/activities/body-contents/ShowBodyMediaByContentType.tsx
3198
3280
  import { InlineMath } from "react-katex";
@@ -4533,23 +4615,13 @@ var DropdownActivityMaterialContent = ({
4533
4615
  setDisplayAnswerMap(answerMap);
4534
4616
  }
4535
4617
  }, [showCorrectAnswer, answerMap, materialMap]);
4536
- const checkAnswerState = (correctAnswer, learnerAnswer) => {
4537
- if (!isPreview) return null;
4538
- if (correctAnswer === learnerAnswer) {
4539
- return "CORRECT";
4540
- }
4541
- return "INCORRECT";
4542
- };
4543
4618
  return /* @__PURE__ */ jsxs18("div", { className: "flex flex-col h-full", children: [
4544
4619
  /* @__PURE__ */ jsx27("div", { className: "hidden md:block flex-shrink-0", children: /* @__PURE__ */ jsx27("span", { className: "font-semibold text-xl opacity-60", children: i18n_default.t("please_select_dropdown_text") }) }),
4545
4620
  /* @__PURE__ */ jsx27("div", { className: "hidden md:block flex-shrink-0", children: /* @__PURE__ */ jsx27(DividerLine_default, {}) }),
4546
4621
  /* @__PURE__ */ jsx27("div", { className: "flex-1 min-h-0 overflow-y-auto", children: /* @__PURE__ */ jsx27("div", { className: "w-full flex flex-row flex-wrap", children: Object.keys(displayAnswerMap).map(
4547
4622
  (materialKey, index) => {
4548
4623
  const answerKey = Object.keys(materialMap[materialKey])[0];
4549
- const learnerAnswerState = checkAnswerState(
4550
- answerKey,
4551
- displayAnswerMap[materialKey]
4552
- );
4624
+ const learnerAnswerState = !isPreview ? null : checkAnswerState(answerKey, displayAnswerMap[materialKey]);
4553
4625
  return /* @__PURE__ */ jsx27("div", { className: "w-full md:w-1/2", children: /* @__PURE__ */ jsx27("div", { className: "mx-2", children: /* @__PURE__ */ jsxs18("div", { className: "w-full flex flex-row my-2 gap-x-2", children: [
4554
4626
  /* @__PURE__ */ jsx27("div", { className: "my-auto", children: /* @__PURE__ */ jsxs18("p", { className: "text-xl", children: [
4555
4627
  parseFloat(materialKey) + 1,
@@ -4793,16 +4865,6 @@ var FillInTheBlanksActivityMaterialContent = ({
4793
4865
  setDisplayAnswerMap(answerMap);
4794
4866
  }
4795
4867
  }, [showCorrectAnswer, answerMap, materialMap]);
4796
- const checkAnswerState = (correctAnswerList, learnerAnswer) => {
4797
- if (!isPreview) return null;
4798
- const foundIndex = correctAnswerList.findIndex(
4799
- (correctAnswer) => correctAnswer === learnerAnswer
4800
- );
4801
- if (foundIndex !== -1) {
4802
- return "CORRECT";
4803
- }
4804
- return "INCORRECT";
4805
- };
4806
4868
  const checkAnswerProvided = (currentAnswerMap, option) => {
4807
4869
  return Object.keys(currentAnswerMap).findIndex(
4808
4870
  (key) => currentAnswerMap[key] === option
@@ -4993,7 +5055,7 @@ var FillInTheBlanksActivityMaterialContent = ({
4993
5055
  )
4994
5056
  ) }),
4995
5057
  /* @__PURE__ */ jsx30("div", { className: "w-full flex flex-row flex-wrap", children: Object.keys(displayAnswerMap).map((materialKey, index) => {
4996
- const learnerAnswerState = checkAnswerState(
5058
+ const learnerAnswerState = !isPreview ? null : checkAnswerState(
4997
5059
  JSON.parse(materialMap[materialKey]),
4998
5060
  displayAnswerMap[materialKey]
4999
5061
  );
@@ -5295,18 +5357,6 @@ var GroupingActivityMaterialContent = ({
5295
5357
  (material) => selectedValueList.findIndex((value) => material === value) === -1
5296
5358
  );
5297
5359
  };
5298
- const checkAnswerState = (correctAnswerList, learnerAnswer) => {
5299
- if (!isPreview) return null;
5300
- if (!learnerAnswer) return "EMPTY";
5301
- if (!correctAnswerList) return "EMPTY";
5302
- const foundIndex = correctAnswerList.findIndex(
5303
- (correctAnswer) => correctAnswer === learnerAnswer
5304
- );
5305
- if (foundIndex !== -1) {
5306
- return "CORRECT";
5307
- }
5308
- return "INCORRECT";
5309
- };
5310
5360
  const handleMouseDown = (e, materialValue) => {
5311
5361
  if (!checkCanAnswerQuestion()) return;
5312
5362
  e.preventDefault();
@@ -5511,10 +5561,7 @@ var GroupingActivityMaterialContent = ({
5511
5561
  className: `${dropTargetKey === answerMapKey ? "bg-catchup-light-blue ring-2 ring-blue-400" : ""} flex-1 border-catchup-blue rounded-catchup-xlarge border-2 h-full p-1 transition-all duration-200`,
5512
5562
  children: /* @__PURE__ */ jsx32("div", { className: "h-full w-full overflow-x-auto", children: /* @__PURE__ */ jsx32("div", { className: "flex flex-row items-center gap-2 w-max h-full", children: displayAnswerMap[answerMapKey].map(
5513
5563
  (answerMapValue, answerMapIndex) => {
5514
- const learnerAnswerState = checkAnswerState(
5515
- materialMap[answerMapKey],
5516
- answerMapValue
5517
- );
5564
+ const learnerAnswerState = !isPreview ? null : !answerMapValue ? "EMPTY" : !materialMap[answerMapKey] ? "EMPTY" : checkAnswerState(materialMap[answerMapKey], answerMapValue);
5518
5565
  return /* @__PURE__ */ jsx32("div", { className: "p-1", children: /* @__PURE__ */ jsx32(
5519
5566
  "div",
5520
5567
  {
@@ -5754,14 +5801,6 @@ var MatchingActivityMaterialContent = ({
5754
5801
  (material) => selectedValueList.findIndex((value) => material === value) === -1
5755
5802
  );
5756
5803
  };
5757
- const checkAnswerState = (correctAnswer, learnerAnswer) => {
5758
- if (!isPreview) return null;
5759
- if (!learnerAnswer) return "EMPTY";
5760
- if (correctAnswer === learnerAnswer) {
5761
- return "CORRECT";
5762
- }
5763
- return "INCORRECT";
5764
- };
5765
5804
  const handleMouseDown = (e, materialValue) => {
5766
5805
  if (!checkCanAnswerQuestion()) return;
5767
5806
  e.preventDefault();
@@ -5943,10 +5982,7 @@ var MatchingActivityMaterialContent = ({
5943
5982
  /* @__PURE__ */ jsx34("div", { className: "flex-shrink-0", children: /* @__PURE__ */ jsx34(DividerLine_default, {}) })
5944
5983
  ] }) : null,
5945
5984
  /* @__PURE__ */ jsx34("div", { className: "flex-1 min-h-0 overflow-y-auto", children: Object.keys(displayAnswerMap).map((answerMapKey, index) => {
5946
- const learnerAnswerState = checkAnswerState(
5947
- materialMap[answerMapKey],
5948
- displayAnswerMap[answerMapKey]
5949
- );
5985
+ const learnerAnswerState = !isPreview ? null : !displayAnswerMap[answerMapKey] ? "EMPTY" : checkAnswerState(materialMap[answerMapKey], displayAnswerMap[answerMapKey]);
5950
5986
  return /* @__PURE__ */ jsxs24("div", { className: "flex flex-row w-full", children: [
5951
5987
  /* @__PURE__ */ jsx34("div", { className: "w-1/3", children: /* @__PURE__ */ jsx34(
5952
5988
  "div",
@@ -6100,17 +6136,6 @@ var MCMAActivityMaterialContent = ({
6100
6136
  const retrieveCorrectAnswerList = () => {
6101
6137
  return JSON.parse(Object.keys(materialMap)[0]);
6102
6138
  };
6103
- const checkAnswerState = (correctAnswerList2, currentAnswer, learnerAnswer) => {
6104
- if (!isPreview) return "HIDDEN";
6105
- if (currentAnswer !== learnerAnswer) return "EMPTY";
6106
- const foundIndex = correctAnswerList2.findIndex(
6107
- (correctAnswer) => correctAnswer === learnerAnswer
6108
- );
6109
- if (foundIndex !== -1) {
6110
- return "CORRECT";
6111
- }
6112
- return "INCORRECT";
6113
- };
6114
6139
  const correctAnswerList = retrieveCorrectAnswerList();
6115
6140
  return /* @__PURE__ */ jsx36("div", { className: "flex flex-col h-full", children: Object.keys(materialMap).map((materialKey, index) => {
6116
6141
  return /* @__PURE__ */ jsx36("div", { className: "flex flex-col flex-1 min-h-0", children: /* @__PURE__ */ jsxs26("div", { className: "flex-1 flex flex-col border-catchup-lighter-gray rounded-catchup-xlarge px-5 md:px-0 min-h-0", children: [
@@ -6121,11 +6146,7 @@ var MCMAActivityMaterialContent = ({
6121
6146
  const foundAnswer = displayAnswerMap[materialKey].find(
6122
6147
  (learnerAnswer) => learnerAnswer === materialSubKey
6123
6148
  );
6124
- const learnerAnswerState = checkAnswerState(
6125
- correctAnswerList,
6126
- materialSubKey,
6127
- foundAnswer
6128
- );
6149
+ const learnerAnswerState = !isPreview ? "HIDDEN" : materialSubKey !== foundAnswer ? "EMPTY" : checkAnswerState(correctAnswerList, foundAnswer);
6129
6150
  const foundIndex = correctAnswerList.findIndex(
6130
6151
  (correctAnswer) => correctAnswer === materialSubKey
6131
6152
  );
@@ -6258,14 +6279,6 @@ var MCSAActivityMaterialContent = ({
6258
6279
  const retrieveCorrectAnswer = () => {
6259
6280
  return Object.keys(materialMap)[0];
6260
6281
  };
6261
- const checkAnswerState = (correctAnswer2, currentAnswer, learnerAnswer) => {
6262
- if (!isPreview) return "HIDDEN";
6263
- if (currentAnswer !== learnerAnswer) return "EMPTY";
6264
- if (correctAnswer2 === learnerAnswer) {
6265
- return "CORRECT";
6266
- }
6267
- return "INCORRECT";
6268
- };
6269
6282
  const correctAnswer = retrieveCorrectAnswer();
6270
6283
  return /* @__PURE__ */ jsx38("div", { className: "flex flex-col h-full", children: Object.keys(materialMap).map((materialKey, index) => {
6271
6284
  return /* @__PURE__ */ jsx38("div", { className: "flex flex-col flex-1 min-h-0", children: /* @__PURE__ */ jsxs28("div", { className: "flex-1 flex flex-col border-catchup-lighter-gray rounded-catchup-xlarge px-5 md:px-0 min-h-0", children: [
@@ -6277,11 +6290,7 @@ var MCSAActivityMaterialContent = ({
6277
6290
  className: `flex flex-row w-full ${Object.keys(materialMap[materialKey]).length <= 4 ? "justify-center" : ""} flex-wrap`,
6278
6291
  children: materialMap[materialKey].map(
6279
6292
  (materialSubKey, index2) => {
6280
- const learnerAnswerState = checkAnswerState(
6281
- correctAnswer,
6282
- materialSubKey,
6283
- displayAnswerMap[materialKey]
6284
- );
6293
+ const learnerAnswerState = !isPreview ? "HIDDEN" : materialSubKey !== displayAnswerMap[materialKey] ? "EMPTY" : checkAnswerState(correctAnswer, displayAnswerMap[materialKey]);
6285
6294
  return /* @__PURE__ */ jsxs28(
6286
6295
  "div",
6287
6296
  {
@@ -6688,13 +6697,6 @@ var OrderingActivityMaterialContent = ({
6688
6697
  setDisplayAnswerMap(answerMap);
6689
6698
  }
6690
6699
  }, [showCorrectAnswer, answerMap]);
6691
- const checkAnswerState = (correctAnswer, learnerAnswer) => {
6692
- if (!isPreview) return null;
6693
- if (correctAnswer === learnerAnswer) {
6694
- return "CORRECT";
6695
- }
6696
- return "INCORRECT";
6697
- };
6698
6700
  const handleMouseDown = (e, materialKey) => {
6699
6701
  if (!checkCanAnswerQuestion()) return;
6700
6702
  e.preventDefault();
@@ -6835,10 +6837,7 @@ var OrderingActivityMaterialContent = ({
6835
6837
  }
6836
6838
  ),
6837
6839
  /* @__PURE__ */ jsx42("div", { className: "flex-1 min-h-0 overflow-y-auto", children: Object.keys(displayAnswerMap).map((materialKey, index) => {
6838
- const learnerAnswerState = checkAnswerState(
6839
- displayAnswerMap[materialKey] + "",
6840
- index + ""
6841
- );
6840
+ const learnerAnswerState = !isPreview ? null : checkAnswerState(displayAnswerMap[materialKey] + "", index + "");
6842
6841
  return /* @__PURE__ */ jsx42("div", { className: "w-full", children: /* @__PURE__ */ jsxs32(
6843
6842
  "div",
6844
6843
  {
@@ -6994,13 +6993,6 @@ var TrueFalseActivityMaterialContent = ({
6994
6993
  setDisplayAnswerMap(answerMap);
6995
6994
  }
6996
6995
  }, [showCorrectAnswer, materialMap, answerMap]);
6997
- const checkAnswerState = (correctAnswer, learnerAnswer) => {
6998
- if (!isPreview) return null;
6999
- if (correctAnswer === learnerAnswer) {
7000
- return "CORRECT";
7001
- }
7002
- return "INCORRECT";
7003
- };
7004
6996
  return /* @__PURE__ */ jsxs34("div", { className: "flex flex-col h-full", children: [
7005
6997
  /* @__PURE__ */ jsx44("div", { className: "hidden md:block flex-shrink-0", children: /* @__PURE__ */ jsx44("span", { className: "font-semibold text-xl opacity-60", children: i18n_default.t("please_select_true_false_text") }) }),
7006
6998
  /* @__PURE__ */ jsx44("div", { className: "hidden md:block flex-shrink-0", children: /* @__PURE__ */ jsx44(DividerLine_default, {}) }),
@@ -7015,10 +7007,7 @@ var TrueFalseActivityMaterialContent = ({
7015
7007
  const learnerAnswer = displayAnswerMap.trueList.find(
7016
7008
  (trueItem) => trueItem === shuffleOption
7017
7009
  ) !== void 0 ? "TRUE" : "FALSE";
7018
- const learnerAnswerState = checkAnswerState(
7019
- correctAnswer,
7020
- learnerAnswer
7021
- );
7010
+ const learnerAnswerState = !isPreview ? null : checkAnswerState(correctAnswer, learnerAnswer);
7022
7011
  return /* @__PURE__ */ jsxs34(
7023
7012
  "div",
7024
7013
  {
@@ -10946,6 +10935,8 @@ export {
10946
10935
  calculateLevenshteinDistance,
10947
10936
  calculateStartDateOfWeek,
10948
10937
  checkActivityAnswerState,
10938
+ checkAnswerState,
10939
+ checkIsActivityAnswerFullyCorrect,
10949
10940
  constructActivityAnswerMap,
10950
10941
  constructActivityAnswerStateList,
10951
10942
  constructActivityData,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catchup-library-web",
3
- "version": "2.6.22",
3
+ "version": "2.6.24",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1,6 +1,6 @@
1
1
  import { InlineMath } from "react-katex";
2
2
  import InputGroup from "../../groups/InputGroup";
3
- import { constructInputWithSpecialExpressionList } from "../../../utilization/CatchtivityUtilization";
3
+ import { constructInputWithSpecialExpressionList, checkAnswerState } from "../../../utilization/CatchtivityUtilization";
4
4
  import i18n from "../../../language/i18n";
5
5
  import { useEffect } from "react";
6
6
  import { useState } from "react";
@@ -38,14 +38,6 @@ const DropdownActivityMaterialContent = ({
38
38
  }
39
39
  }, [showCorrectAnswer, answerMap, materialMap]);
40
40
 
41
- const checkAnswerState = (correctAnswer: string, learnerAnswer: string) => {
42
- if (!isPreview) return null;
43
- if (correctAnswer === learnerAnswer) {
44
- return "CORRECT";
45
- }
46
- return "INCORRECT";
47
- };
48
-
49
41
  return (
50
42
  <div className="flex flex-col h-full">
51
43
  <div className="hidden md:block flex-shrink-0">
@@ -61,10 +53,9 @@ const DropdownActivityMaterialContent = ({
61
53
  {Object.keys(displayAnswerMap).map(
62
54
  (materialKey: string, index: number) => {
63
55
  const answerKey = Object.keys(materialMap[materialKey])[0];
64
- const learnerAnswerState = checkAnswerState(
65
- answerKey,
66
- displayAnswerMap[materialKey]
67
- );
56
+ const learnerAnswerState = !isPreview
57
+ ? null
58
+ : checkAnswerState(answerKey, displayAnswerMap[materialKey]);
68
59
  return (
69
60
  <div key={index} className="w-full md:w-1/2">
70
61
  <div className="mx-2">
@@ -7,7 +7,7 @@ import DividerLine from "../../dividers/DividerLine";
7
7
  import { IFillInTheBlanksActivityMaterialProps } from "../../../properties/ActivityProperties";
8
8
  import InputWithSpecialExpression from "../../texts/InputWithSpecialExpression";
9
9
  import i18n from "../../../language/i18n";
10
- import { constructInputWithSpecialExpressionList } from "../../../utilization/CatchtivityUtilization";
10
+ import { constructInputWithSpecialExpressionList, checkAnswerState } from "../../../utilization/CatchtivityUtilization";
11
11
 
12
12
  const FillInTheBlanksActivityMaterialContent = ({
13
13
  uniqueValue,
@@ -68,20 +68,6 @@ const FillInTheBlanksActivityMaterialContent = ({
68
68
  }
69
69
  }, [showCorrectAnswer, answerMap, materialMap]);
70
70
 
71
- const checkAnswerState = (
72
- correctAnswerList: any[],
73
- learnerAnswer: string,
74
- ): string | null => {
75
- if (!isPreview) return null;
76
- const foundIndex = correctAnswerList.findIndex(
77
- (correctAnswer: string) => correctAnswer === learnerAnswer,
78
- );
79
- if (foundIndex !== -1) {
80
- return "CORRECT";
81
- }
82
- return "INCORRECT";
83
- };
84
-
85
71
  const checkAnswerProvided = (
86
72
  currentAnswerMap: Record<string, any>,
87
73
  option: string,
@@ -323,10 +309,12 @@ const FillInTheBlanksActivityMaterialContent = ({
323
309
  </div>
324
310
  <div className="w-full flex flex-row flex-wrap">
325
311
  {Object.keys(displayAnswerMap).map((materialKey, index) => {
326
- const learnerAnswerState = checkAnswerState(
327
- JSON.parse(materialMap[materialKey]),
328
- displayAnswerMap[materialKey],
329
- );
312
+ const learnerAnswerState = !isPreview
313
+ ? null
314
+ : checkAnswerState(
315
+ JSON.parse(materialMap[materialKey]),
316
+ displayAnswerMap[materialKey],
317
+ );
330
318
  return (
331
319
  <div key={index} className="w-full md:w-1/2">
332
320
  <div className="mx-2">
@@ -1,7 +1,7 @@
1
1
  import { useEffect, useRef, useState } from "react";
2
2
  import ShowMaterialMediaByContentType from "./ShowMaterialMediaByContentType";
3
3
  import { InlineMath } from "react-katex";
4
- import { constructInputWithSpecialExpressionList } from "../../../utilization/CatchtivityUtilization";
4
+ import { constructInputWithSpecialExpressionList, checkAnswerState } from "../../../utilization/CatchtivityUtilization";
5
5
  import DividerLine from "../../dividers/DividerLine";
6
6
  import { IGroupingActivityMaterialProps } from "../../../properties/ActivityProperties";
7
7
 
@@ -157,19 +157,6 @@ const GroupingActivityMaterialContent = ({
157
157
  );
158
158
  };
159
159
 
160
- const checkAnswerState = (correctAnswerList: any, learnerAnswer: string) => {
161
- if (!isPreview) return null;
162
- if (!learnerAnswer) return "EMPTY";
163
- if (!correctAnswerList) return "EMPTY";
164
- const foundIndex = correctAnswerList.findIndex(
165
- (correctAnswer: string) => correctAnswer === learnerAnswer,
166
- );
167
- if (foundIndex !== -1) {
168
- return "CORRECT";
169
- }
170
- return "INCORRECT";
171
- };
172
-
173
160
  const handleMouseDown = (
174
161
  e: React.MouseEvent,
175
162
  materialValue: string,
@@ -493,10 +480,13 @@ const GroupingActivityMaterialContent = ({
493
480
  <div className="flex flex-row items-center gap-2 w-max h-full">
494
481
  {displayAnswerMap[answerMapKey].map(
495
482
  (answerMapValue: string, answerMapIndex: number) => {
496
- const learnerAnswerState = checkAnswerState(
497
- materialMap[answerMapKey],
498
- answerMapValue,
499
- );
483
+ const learnerAnswerState = !isPreview
484
+ ? null
485
+ : !answerMapValue
486
+ ? "EMPTY"
487
+ : !materialMap[answerMapKey]
488
+ ? "EMPTY"
489
+ : checkAnswerState(materialMap[answerMapKey], answerMapValue);
500
490
  return (
501
491
  <div key={answerMapIndex} className="p-1">
502
492
  <div
@@ -1,6 +1,6 @@
1
1
  import { useEffect, useState } from "react";
2
2
  import { InlineMath } from "react-katex";
3
- import { constructInputWithSpecialExpressionList } from "../../../utilization/CatchtivityUtilization";
3
+ import { constructInputWithSpecialExpressionList, checkAnswerState } from "../../../utilization/CatchtivityUtilization";
4
4
  import ShowMaterialMediaByContentType from "./ShowMaterialMediaByContentType";
5
5
  import i18n from "../../../language/i18n";
6
6
  import BaseImage from "../../images/BaseImage";
@@ -37,22 +37,6 @@ const MCMAActivityMaterialContent = ({
37
37
  return JSON.parse(Object.keys(materialMap)[0]);
38
38
  };
39
39
 
40
- const checkAnswerState = (
41
- correctAnswerList: any,
42
- currentAnswer: string,
43
- learnerAnswer: string
44
- ) => {
45
- if (!isPreview) return "HIDDEN";
46
- if (currentAnswer !== learnerAnswer) return "EMPTY";
47
- const foundIndex = correctAnswerList.findIndex(
48
- (correctAnswer: string) => correctAnswer === learnerAnswer
49
- );
50
- if (foundIndex !== -1) {
51
- return "CORRECT";
52
- }
53
- return "INCORRECT";
54
- };
55
-
56
40
  const correctAnswerList = retrieveCorrectAnswerList();
57
41
 
58
42
  return (<div className="flex flex-col h-full">{Object.keys(materialMap).map((materialKey, index) => {
@@ -75,11 +59,11 @@ const MCMAActivityMaterialContent = ({
75
59
  const foundAnswer = displayAnswerMap[materialKey].find(
76
60
  (learnerAnswer: string) => learnerAnswer === materialSubKey
77
61
  );
78
- const learnerAnswerState = checkAnswerState(
79
- correctAnswerList,
80
- materialSubKey,
81
- foundAnswer
82
- );
62
+ const learnerAnswerState = !isPreview
63
+ ? "HIDDEN"
64
+ : materialSubKey !== foundAnswer
65
+ ? "EMPTY"
66
+ : checkAnswerState(correctAnswerList, foundAnswer);
83
67
  const foundIndex = correctAnswerList.findIndex(
84
68
  (correctAnswer: string) => correctAnswer === materialSubKey
85
69
  );
@@ -2,7 +2,7 @@ import { useEffect, useState } from "react";
2
2
  import { InlineMath } from "react-katex";
3
3
  import ShowMaterialMediaByContentType from "./ShowMaterialMediaByContentType";
4
4
  import i18n from "../../../language/i18n";
5
- import { constructInputWithSpecialExpressionList } from "../../../utilization/CatchtivityUtilization";
5
+ import { constructInputWithSpecialExpressionList, checkAnswerState } from "../../../utilization/CatchtivityUtilization";
6
6
  import BaseImage from "../../images/BaseImage";
7
7
  import { IMCSAActivityMaterialProps } from "../../../properties/ActivityProperties";
8
8
  import DividerLine from "../../dividers/DividerLine";
@@ -32,19 +32,6 @@ const MCSAActivityMaterialContent = ({
32
32
  return Object.keys(materialMap)[0];
33
33
  };
34
34
 
35
- const checkAnswerState = (
36
- correctAnswer: string,
37
- currentAnswer: string,
38
- learnerAnswer: string
39
- ) => {
40
- if (!isPreview) return "HIDDEN";
41
- if (currentAnswer !== learnerAnswer) return "EMPTY";
42
- if (correctAnswer === learnerAnswer) {
43
- return "CORRECT";
44
- }
45
- return "INCORRECT";
46
- };
47
-
48
35
  const correctAnswer = retrieveCorrectAnswer();
49
36
 
50
37
  return (<div className="flex flex-col h-full">{Object.keys(materialMap).map((materialKey, index) => {
@@ -70,11 +57,11 @@ const MCSAActivityMaterialContent = ({
70
57
  >
71
58
  {materialMap[materialKey].map(
72
59
  (materialSubKey: string, index: number) => {
73
- const learnerAnswerState = checkAnswerState(
74
- correctAnswer,
75
- materialSubKey,
76
- displayAnswerMap[materialKey]
77
- );
60
+ const learnerAnswerState = !isPreview
61
+ ? "HIDDEN"
62
+ : materialSubKey !== displayAnswerMap[materialKey]
63
+ ? "EMPTY"
64
+ : checkAnswerState(correctAnswer, displayAnswerMap[materialKey]);
78
65
 
79
66
  return (
80
67
  <div
@@ -1,7 +1,7 @@
1
1
  import { useEffect, useRef, useState } from "react";
2
2
  import ShowMaterialMediaByContentType from "./ShowMaterialMediaByContentType";
3
3
  import { InlineMath } from "react-katex";
4
- import { constructInputWithSpecialExpressionList } from "../../../utilization/CatchtivityUtilization";
4
+ import { constructInputWithSpecialExpressionList, checkAnswerState } from "../../../utilization/CatchtivityUtilization";
5
5
  import { IMatchingActivityMaterialProps } from "../../../properties/ActivityProperties";
6
6
  import DividerLine from "../../dividers/DividerLine";
7
7
 
@@ -155,15 +155,6 @@ const MatchingActivityMaterialContent = ({
155
155
  );
156
156
  };
157
157
 
158
- const checkAnswerState = (correctAnswer: string, learnerAnswer: string) => {
159
- if (!isPreview) return null;
160
- if (!learnerAnswer) return "EMPTY";
161
- if (correctAnswer === learnerAnswer) {
162
- return "CORRECT";
163
- }
164
- return "INCORRECT";
165
- };
166
-
167
158
  // Mouse drag handlers
168
159
  const handleMouseDown = (
169
160
  e: React.MouseEvent,
@@ -440,10 +431,11 @@ const MatchingActivityMaterialContent = ({
440
431
 
441
432
  <div className="flex-1 min-h-0 overflow-y-auto">
442
433
  {Object.keys(displayAnswerMap).map((answerMapKey, index) => {
443
- const learnerAnswerState = checkAnswerState(
444
- materialMap[answerMapKey],
445
- displayAnswerMap[answerMapKey],
446
- );
434
+ const learnerAnswerState = !isPreview
435
+ ? null
436
+ : !displayAnswerMap[answerMapKey]
437
+ ? "EMPTY"
438
+ : checkAnswerState(materialMap[answerMapKey], displayAnswerMap[answerMapKey]);
447
439
 
448
440
  return (
449
441
  <div key={index} className="flex flex-row w-full">
@@ -1,7 +1,7 @@
1
1
  import { useEffect, useState, useRef } from "react";
2
2
  import ShowMaterialMediaByContentType from "./ShowMaterialMediaByContentType";
3
3
  import { InlineMath } from "react-katex";
4
- import { constructInputWithSpecialExpressionList } from "../../../utilization/CatchtivityUtilization";
4
+ import { constructInputWithSpecialExpressionList, checkAnswerState } from "../../../utilization/CatchtivityUtilization";
5
5
  import { IOrderingActivityMaterialProps } from "../../../properties/ActivityProperties";
6
6
 
7
7
  const OrderingActivityMaterialContent = ({
@@ -54,14 +54,6 @@ const OrderingActivityMaterialContent = ({
54
54
  }
55
55
  }, [showCorrectAnswer, answerMap]);
56
56
 
57
- const checkAnswerState = (correctAnswer: string, learnerAnswer: string) => {
58
- if (!isPreview) return null;
59
- if (correctAnswer === learnerAnswer) {
60
- return "CORRECT";
61
- }
62
- return "INCORRECT";
63
- };
64
-
65
57
  const handleMouseDown = (e: React.MouseEvent, materialKey: string): void => {
66
58
  if (!checkCanAnswerQuestion()) return;
67
59
  e.preventDefault();
@@ -262,10 +254,9 @@ const OrderingActivityMaterialContent = ({
262
254
 
263
255
  <div className="flex-1 min-h-0 overflow-y-auto">
264
256
  {Object.keys(displayAnswerMap).map((materialKey, index) => {
265
- const learnerAnswerState = checkAnswerState(
266
- displayAnswerMap[materialKey] + "",
267
- index + "",
268
- );
257
+ const learnerAnswerState = !isPreview
258
+ ? null
259
+ : checkAnswerState(displayAnswerMap[materialKey] + "", index + "");
269
260
  return (
270
261
  <div className="w-full" key={index}>
271
262
  <div
@@ -2,7 +2,7 @@ import { useEffect, useState } from "react";
2
2
  import i18n from "../../../language/i18n";
3
3
  import ShowMaterialMediaByContentType from "./ShowMaterialMediaByContentType";
4
4
  import { InlineMath } from "react-katex";
5
- import { constructInputWithSpecialExpressionList } from "../../../utilization/CatchtivityUtilization";
5
+ import { constructInputWithSpecialExpressionList, checkAnswerState } from "../../../utilization/CatchtivityUtilization";
6
6
  import BaseImage from "../../images/BaseImage";
7
7
  import { ITrueFalseActivityMaterialProps } from "../../../properties/ActivityProperties";
8
8
  import DividerLine from "../../dividers/DividerLine";
@@ -40,14 +40,6 @@ const TrueFalseActivityMaterialContent = ({
40
40
  }
41
41
  }, [showCorrectAnswer, materialMap, answerMap]);
42
42
 
43
- const checkAnswerState = (correctAnswer: string, learnerAnswer: string) => {
44
- if (!isPreview) return null;
45
- if (correctAnswer === learnerAnswer) {
46
- return "CORRECT";
47
- }
48
- return "INCORRECT";
49
- };
50
-
51
43
  return (
52
44
  <div className="flex flex-col h-full">
53
45
  <div className="hidden md:block flex-shrink-0">
@@ -83,10 +75,9 @@ const TrueFalseActivityMaterialContent = ({
83
75
  ? "TRUE"
84
76
  : "FALSE";
85
77
 
86
- const learnerAnswerState = checkAnswerState(
87
- correctAnswer,
88
- learnerAnswer
89
- );
78
+ const learnerAnswerState = !isPreview
79
+ ? null
80
+ : checkAnswerState(correctAnswer, learnerAnswer);
90
81
 
91
82
  return (
92
83
  <div
@@ -2308,3 +2308,110 @@ export const retrieveActivityCountOptionList = () => {
2308
2308
  },
2309
2309
  ];
2310
2310
  };
2311
+
2312
+ export const checkAnswerState = (
2313
+ correctAnswer: any,
2314
+ learnerAnswer: any
2315
+ ): string => {
2316
+ if (Array.isArray(correctAnswer)) {
2317
+ return correctAnswer.some((ca: string) => ca === learnerAnswer)
2318
+ ? "CORRECT"
2319
+ : "INCORRECT";
2320
+ }
2321
+ return correctAnswer === learnerAnswer ? "CORRECT" : "INCORRECT";
2322
+ };
2323
+
2324
+ export const checkIsActivityAnswerFullyCorrect = (
2325
+ activityTemplateType: string,
2326
+ answerMap: any,
2327
+ activityData: any
2328
+ ) => {
2329
+ if (!answerMap || !activityData) return false;
2330
+ if (activityTemplateType === "OPEN_ENDED") return false;
2331
+
2332
+ const materialMap = parseMaterialMapFromData(
2333
+ activityData,
2334
+ activityTemplateType
2335
+ );
2336
+ if (!materialMap) return false;
2337
+
2338
+ if (activityTemplateType === "MCSA") {
2339
+ const correctAnswer = Object.keys(materialMap)[0];
2340
+ return Object.keys(answerMap).every(
2341
+ (key) => checkAnswerState(correctAnswer, answerMap[key]) === "CORRECT"
2342
+ );
2343
+ }
2344
+
2345
+ if (activityTemplateType === "MCMA") {
2346
+ const correctAnswerList = JSON.parse(Object.keys(materialMap)[0]);
2347
+ return Object.keys(answerMap).every((key) => {
2348
+ const learnerAnswers = answerMap[key];
2349
+ if (!Array.isArray(learnerAnswers)) return false;
2350
+ if (learnerAnswers.length !== correctAnswerList.length) return false;
2351
+ return learnerAnswers.every(
2352
+ (la: string) => checkAnswerState(correctAnswerList, la) === "CORRECT"
2353
+ );
2354
+ });
2355
+ }
2356
+
2357
+ if (activityTemplateType === "TRUE_FALSE") {
2358
+ const correctTrueList = materialMap.trueList || [];
2359
+ const correctFalseList = materialMap.falseList || [];
2360
+ const learnerTrueList = answerMap.trueList || [];
2361
+ const learnerFalseList = answerMap.falseList || [];
2362
+ if (learnerTrueList.length !== correctTrueList.length) return false;
2363
+ if (learnerFalseList.length !== correctFalseList.length) return false;
2364
+ const allTrueCorrect = correctTrueList.every(
2365
+ (item: string) => checkAnswerState(correctTrueList, item) === "CORRECT"
2366
+ && learnerTrueList.includes(item)
2367
+ );
2368
+ const allFalseCorrect = correctFalseList.every(
2369
+ (item: string) => checkAnswerState(correctFalseList, item) === "CORRECT"
2370
+ && learnerFalseList.includes(item)
2371
+ );
2372
+ return allTrueCorrect && allFalseCorrect;
2373
+ }
2374
+
2375
+ if (activityTemplateType === "ORDERING") {
2376
+ return Object.keys(answerMap).every(
2377
+ (key: string, index: number) =>
2378
+ checkAnswerState(index + "", answerMap[key] + "") === "CORRECT"
2379
+ );
2380
+ }
2381
+
2382
+ if (activityTemplateType === "DROPDOWN") {
2383
+ return Object.keys(materialMap).every((key: string) => {
2384
+ const correctAnswer = Object.keys(materialMap[key])[0];
2385
+ return checkAnswerState(correctAnswer, answerMap[key]) === "CORRECT";
2386
+ });
2387
+ }
2388
+
2389
+ if (activityTemplateType === "MATCHING") {
2390
+ return Object.keys(materialMap).every(
2391
+ (key: string) =>
2392
+ checkAnswerState(materialMap[key], answerMap[key]) === "CORRECT"
2393
+ );
2394
+ }
2395
+
2396
+ if (activityTemplateType === "GROUPING") {
2397
+ return Object.keys(materialMap).every((key: string) => {
2398
+ const correctItems = materialMap[key];
2399
+ const learnerItems = answerMap[key] || [];
2400
+ if (!Array.isArray(correctItems) || !Array.isArray(learnerItems))
2401
+ return false;
2402
+ if (correctItems.length !== learnerItems.length) return false;
2403
+ return learnerItems.every(
2404
+ (item: string) => checkAnswerState(correctItems, item) === "CORRECT"
2405
+ );
2406
+ });
2407
+ }
2408
+
2409
+ if (activityTemplateType === "FILL_IN_THE_BLANKS") {
2410
+ return Object.keys(materialMap).every((key: string) => {
2411
+ const acceptableAnswers = JSON.parse(materialMap[key]);
2412
+ return checkAnswerState(acceptableAnswers, answerMap[key]) === "CORRECT";
2413
+ });
2414
+ }
2415
+
2416
+ return false;
2417
+ };