catchup-library-web 1.2.7 → 1.2.8

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.js CHANGED
@@ -2694,15 +2694,29 @@ var constructActivityItemListMaterialOnly = (materialMap, type) => {
2694
2694
  }
2695
2695
  } else if (type === "DROPDOWN") {
2696
2696
  if (Object.keys(materialMap).length > 0) {
2697
- itemList.push({
2698
- type: "text",
2699
- text: `${i18n_default.t("correct_blanks")}: `
2700
- });
2701
2697
  Object.keys(materialMap).forEach((key, index) => {
2702
- console.log(materialMap[key]);
2698
+ const materialInnerMap = JSON.parse(materialMap[key]);
2699
+ const innerKey = Object.keys(materialInnerMap)[0];
2700
+ console.log("innerKey", innerKey);
2701
+ const optionList = JSON.parse(materialInnerMap[innerKey]);
2702
+ console.log("optionList", optionList);
2703
+ let currentText = "";
2704
+ for (const option of optionList) {
2705
+ let prefix = "";
2706
+ if (option === innerKey) {
2707
+ prefix = `[${i18n_default.t("correct")}]`;
2708
+ } else {
2709
+ prefix = `[${i18n_default.t("incorrect")}]`;
2710
+ }
2711
+ currentText += `${prefix}${option}, `;
2712
+ }
2713
+ console.log("currentText", currentText);
2703
2714
  itemList.push({
2704
2715
  type: "text",
2705
- text: `${index + 1}. ${Object.keys(materialMap[key])[0]}`
2716
+ text: `${index + 1}. ${currentText.substring(
2717
+ 0,
2718
+ currentText.length - 2
2719
+ )}`
2706
2720
  });
2707
2721
  });
2708
2722
  }
package/dist/index.mjs CHANGED
@@ -2514,15 +2514,29 @@ var constructActivityItemListMaterialOnly = (materialMap, type) => {
2514
2514
  }
2515
2515
  } else if (type === "DROPDOWN") {
2516
2516
  if (Object.keys(materialMap).length > 0) {
2517
- itemList.push({
2518
- type: "text",
2519
- text: `${i18n_default.t("correct_blanks")}: `
2520
- });
2521
2517
  Object.keys(materialMap).forEach((key, index) => {
2522
- console.log(materialMap[key]);
2518
+ const materialInnerMap = JSON.parse(materialMap[key]);
2519
+ const innerKey = Object.keys(materialInnerMap)[0];
2520
+ console.log("innerKey", innerKey);
2521
+ const optionList = JSON.parse(materialInnerMap[innerKey]);
2522
+ console.log("optionList", optionList);
2523
+ let currentText = "";
2524
+ for (const option of optionList) {
2525
+ let prefix = "";
2526
+ if (option === innerKey) {
2527
+ prefix = `[${i18n_default.t("correct")}]`;
2528
+ } else {
2529
+ prefix = `[${i18n_default.t("incorrect")}]`;
2530
+ }
2531
+ currentText += `${prefix}${option}, `;
2532
+ }
2533
+ console.log("currentText", currentText);
2523
2534
  itemList.push({
2524
2535
  type: "text",
2525
- text: `${index + 1}. ${Object.keys(materialMap[key])[0]}`
2536
+ text: `${index + 1}. ${currentText.substring(
2537
+ 0,
2538
+ currentText.length - 2
2539
+ )}`
2526
2540
  });
2527
2541
  });
2528
2542
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catchup-library-web",
3
- "version": "1.2.7",
3
+ "version": "1.2.8",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -2007,15 +2007,29 @@ export const constructActivityItemListMaterialOnly = (
2007
2007
  }
2008
2008
  } else if (type === "DROPDOWN") {
2009
2009
  if (Object.keys(materialMap).length > 0) {
2010
- itemList.push({
2011
- type: "text",
2012
- text: `${i18n.t("correct_blanks")}: `,
2013
- });
2014
2010
  Object.keys(materialMap).forEach((key, index) => {
2015
- console.log(materialMap[key]);
2011
+ const materialInnerMap = JSON.parse(materialMap[key]);
2012
+ const innerKey = Object.keys(materialInnerMap)[0];
2013
+ console.log("innerKey", innerKey);
2014
+ const optionList = JSON.parse(materialInnerMap[innerKey]);
2015
+ console.log("optionList", optionList);
2016
+ let currentText = "";
2017
+ for (const option of optionList) {
2018
+ let prefix = "";
2019
+ if (option === innerKey) {
2020
+ prefix = `[${i18n.t("correct")}]`;
2021
+ } else {
2022
+ prefix = `[${i18n.t("incorrect")}]`;
2023
+ }
2024
+ currentText += `${prefix}${option}, `;
2025
+ }
2026
+ console.log("currentText", currentText);
2016
2027
  itemList.push({
2017
2028
  type: "text",
2018
- text: `${index + 1}. ${Object.keys(materialMap[key])[0]}`,
2029
+ text: `${index + 1}. ${currentText.substring(
2030
+ 0,
2031
+ currentText.length - 2
2032
+ )}`,
2019
2033
  });
2020
2034
  });
2021
2035
  }