touchstudy-core 0.1.151 → 0.1.152

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.
@@ -6532,26 +6532,23 @@ var formatDataMyAnswer = function formatDataMyAnswer(inputData, categories) {
6532
6532
  });
6533
6533
  return questionsByCategory;
6534
6534
  };
6535
- var formatTextbookDataMyAnswer = function formatTextbookDataMyAnswer(inputData, categories) {
6536
- var uniqueCategories = new Set();
6537
- var filterCategories = categories.filter(function (category) {
6538
- if (!uniqueCategories.has(category.name)) {
6539
- uniqueCategories.add(category.name);
6540
- return true;
6541
- }
6542
- return false;
6543
- });
6544
- var questionsByCategory = filterCategories.map(function (category) {
6535
+ var formatTextbookDataMyAnswer = function formatTextbookDataMyAnswer(inputData, questionGroupIds) {
6536
+ var questionsByCategories = questionGroupIds.map(function (questionGroupId) {
6537
+ var _questions$, _questions$$categorie, _questions$2, _questions$2$categori;
6538
+ var questions = inputData.studentQuestionResults.filter(function (question) {
6539
+ return question.questionGroupId === questionGroupId;
6540
+ });
6541
+ var category = questions === null || questions === void 0 ? void 0 : (_questions$ = questions[0]) === null || _questions$ === void 0 ? void 0 : (_questions$$categorie = _questions$.categories) === null || _questions$$categorie === void 0 ? void 0 : _questions$$categorie[0];
6542
+ var subcategory = !category ? null : questions === null || questions === void 0 ? void 0 : (_questions$2 = questions[0]) === null || _questions$2 === void 0 ? void 0 : (_questions$2$categori = _questions$2.categories) === null || _questions$2$categori === void 0 ? void 0 : _questions$2$categori.find(function (c) {
6543
+ return !!c.parentCategoryId && c.parentCategoryId === (category === null || category === void 0 ? void 0 : category.id);
6544
+ });
6545
6545
  return {
6546
- category: category,
6547
- questions: inputData.studentQuestionResults.filter(function (question) {
6548
- return !!question.categories.find(function (i) {
6549
- return i.name === category.name;
6550
- });
6551
- })
6546
+ categories: category && subcategory ? [category, subcategory] : category ? [category] : [],
6547
+ questions: questions,
6548
+ questionGroupId: questionGroupId
6552
6549
  };
6553
6550
  });
6554
- return questionsByCategory;
6551
+ return questionsByCategories;
6555
6552
  };
6556
6553
  var totalSolveTimeCategories = function totalSolveTimeCategories(inputData, categories) {
6557
6554
  var uniqueCategories = new Set();
@@ -18516,7 +18513,7 @@ var TextbookAnswerItem = function TextbookAnswerItem(_ref) {
18516
18513
  nextData = _ref.nextData,
18517
18514
  isFirst = _ref.isFirst,
18518
18515
  isLast = _ref.isLast,
18519
- categoryId = _ref.categoryId,
18516
+ questionGroupId = _ref.questionGroupId,
18520
18517
  _ref$menuContextActio = _ref.menuContextActions,
18521
18518
  menuContextActions = _ref$menuContextActio === void 0 ? [] : _ref$menuContextActio,
18522
18519
  openContextMenu = _ref.openContextMenu,
@@ -18528,14 +18525,14 @@ var TextbookAnswerItem = function TextbookAnswerItem(_ref) {
18528
18525
  var isLearningSpace = getLearningSpace();
18529
18526
  var handleCloseContextMenu = function handleCloseContextMenu() {
18530
18527
  onCloseContextMenu === null || onCloseContextMenu === void 0 ? void 0 : onCloseContextMenu(_extends({}, data, {
18531
- id: ((data === null || data === void 0 ? void 0 : data.id) || 0) + categoryId
18528
+ id: ((data === null || data === void 0 ? void 0 : data.id) || 0) + questionGroupId
18532
18529
  }));
18533
18530
  };
18534
18531
  var handleMoreClick = function handleMoreClick(e) {
18535
18532
  e.preventDefault();
18536
18533
  e.stopPropagation();
18537
18534
  onOpenContextMenu === null || onOpenContextMenu === void 0 ? void 0 : onOpenContextMenu(_extends({}, data, {
18538
- id: ((data === null || data === void 0 ? void 0 : data.id) || 0) + categoryId
18535
+ id: ((data === null || data === void 0 ? void 0 : data.id) || 0) + questionGroupId
18539
18536
  }));
18540
18537
  };
18541
18538
  return React__default.createElement("div", {
@@ -18662,24 +18659,28 @@ var TextbookAnswerItem = function TextbookAnswerItem(_ref) {
18662
18659
 
18663
18660
  var TextbookMyAnswer = function TextbookMyAnswer(_ref) {
18664
18661
  var data = _ref.data,
18665
- categories = _ref.categories,
18666
18662
  itemProps = _ref.itemProps,
18667
18663
  questionIdContextMenu = _ref.questionIdContextMenu,
18668
18664
  isStudent = _ref.isStudent;
18669
- var formattedData = formatTextbookDataMyAnswer(data, categories);
18665
+ var questionGroupIds = Array.from(new Set(data.studentQuestionResults.map(function (i) {
18666
+ return i.questionGroupId;
18667
+ }))).sort(function (a, b) {
18668
+ return a - b;
18669
+ });
18670
+ var formattedData = formatTextbookDataMyAnswer(data, questionGroupIds);
18670
18671
  var _useTranslation = useTranslation(),
18671
18672
  t = _useTranslation.t;
18672
- var renderAnswer = function renderAnswer(item, index, questions, categoryId) {
18673
+ var renderAnswer = function renderAnswer(item, index, questions, questionGroupId) {
18673
18674
  var nextItem = index < questions.length - 1 ? questions[index + 1] : undefined;
18674
18675
  var isLast = index === questions.length - 1;
18675
18676
  var isFirst = index === 0;
18676
- var isSelected = (item === null || item === void 0 ? void 0 : item.id) + categoryId === questionIdContextMenu;
18677
+ var isSelected = (item === null || item === void 0 ? void 0 : item.id) + questionGroupId === questionIdContextMenu;
18677
18678
  return React__default.createElement(TextbookAnswerItem, Object.assign({
18678
18679
  key: index
18679
18680
  }, itemProps, {
18680
18681
  openContextMenu: isSelected,
18681
18682
  data: item,
18682
- categoryId: categoryId,
18683
+ questionGroupId: questionGroupId,
18683
18684
  nextData: nextItem,
18684
18685
  isLast: isLast,
18685
18686
  isFirst: isFirst,
@@ -18689,8 +18690,9 @@ var TextbookMyAnswer = function TextbookMyAnswer(_ref) {
18689
18690
  return React__default.createElement("div", {
18690
18691
  className: "" + styles$4["myanswer"]
18691
18692
  }, formattedData && formattedData.length > 0 && formattedData.map(function (item) {
18693
+ var _item$categories;
18692
18694
  return React__default.createElement("div", {
18693
- key: item.category.id
18695
+ key: item.questionGroupId
18694
18696
  }, React__default.createElement("div", {
18695
18697
  className: "" + printStyles["avoid-break-inside"]
18696
18698
  }, React__default.createElement(Stack, {
@@ -18788,12 +18790,14 @@ var TextbookMyAnswer = function TextbookMyAnswer(_ref) {
18788
18790
  fontSize: "12px",
18789
18791
  fontWeight: 700
18790
18792
  }
18791
- }, item.category.name))), React__default.createElement("div", {
18793
+ }, (_item$categories = item.categories) === null || _item$categories === void 0 ? void 0 : _item$categories.map(function (i) {
18794
+ return i.name;
18795
+ }).join(" / ")))), React__default.createElement("div", {
18792
18796
  className: styles$4["contentMyAnswer"]
18793
18797
  }, React__default.createElement(ListView, {
18794
18798
  data: item.questions,
18795
18799
  render: function render(question, index) {
18796
- return renderAnswer(question, index, item.questions, item.category.id);
18800
+ return renderAnswer(question, index, item.questions, item.questionGroupId);
18797
18801
  }
18798
18802
  })));
18799
18803
  }));
@@ -20905,7 +20909,6 @@ var ExamResultV2 = function ExamResultV2(props) {
20905
20909
  index: 0
20906
20910
  }, chapterId ? textbookResult && React__default.createElement(TextbookMyAnswer, {
20907
20911
  data: textbookResult,
20908
- categories: categoryResponses,
20909
20912
  isStudent: isStudent,
20910
20913
  questionIdContextMenu: questionIdContextMenu,
20911
20914
  itemProps: questionItemProp