touchstudy-core 0.1.30 → 0.1.32

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.
@@ -1356,6 +1356,7 @@ var duration = "시험 시간";
1356
1356
  var answer_count = "답변 수";
1357
1357
  var question_count = "문제 갯수";
1358
1358
  var category = "문항 카테고리";
1359
+ var _category = "카테고리";
1359
1360
  var save_and_exit = "저장 및 종료";
1360
1361
  var update_exam = "시험 업데이트";
1361
1362
  var create_exam = "새 시험 만들기";
@@ -1547,6 +1548,7 @@ var users = "사용자";
1547
1548
  var new_user = "새로운 사용자";
1548
1549
  var academy_admin = "아카데미 관리자";
1549
1550
  var switch_academy_admin = "스위치 아카데미 관리자";
1551
+ var switch_academy = "스위치 아카데미";
1550
1552
  var there_are_no_lessons_this_week = "이번주는 수업이 없습니다";
1551
1553
  var update_message = "업데이트 메시지";
1552
1554
  var attachment = "첨부 파일";
@@ -1565,6 +1567,16 @@ var number_of_classes = "{{ number }} 개";
1565
1567
  var complete_conversation_successfully = "대화를 성공적으로 완료했습니다";
1566
1568
  var fail_to_complete_conversation = "대화를 완료하지 못했습니다";
1567
1569
  var are_you_sure_you_want_to_complete_this_conversation = "정말로 이 채팅 베팅을 완료하시겠습니까?";
1570
+ var switch_academy_fail = "아카데미 전환 실패";
1571
+ var no_academy_available = "이용 가능한 아카데미가 없습니다";
1572
+ var my_classes_calendar = "내 수업 캘린더";
1573
+ var enter_exam_code = "시험 코드 입력";
1574
+ var my_score = "내 점수";
1575
+ var exam_date = "시험 날짜";
1576
+ var my_problem_solving_order = "내 순서";
1577
+ var top_rankings_problem_solving_order = "상위권 학생의 순서";
1578
+ var comparison_of_top_rankings_and_problem_solving_order = "상위권과 문제 푸는 순서 비교";
1579
+ var my_answers = "내 해답";
1568
1580
  var lang_ko = {
1569
1581
  problem_solving: problem_solving,
1570
1582
  my_story: my_story,
@@ -1635,6 +1647,7 @@ var lang_ko = {
1635
1647
  answer_count: answer_count,
1636
1648
  question_count: question_count,
1637
1649
  category: category,
1650
+ _category: _category,
1638
1651
  save_and_exit: save_and_exit,
1639
1652
  update_exam: update_exam,
1640
1653
  create_exam: create_exam,
@@ -1823,6 +1836,7 @@ var lang_ko = {
1823
1836
  new_user: new_user,
1824
1837
  academy_admin: academy_admin,
1825
1838
  switch_academy_admin: switch_academy_admin,
1839
+ switch_academy: switch_academy,
1826
1840
  there_are_no_lessons_this_week: there_are_no_lessons_this_week,
1827
1841
  update_message: update_message,
1828
1842
  attachment: attachment,
@@ -1840,7 +1854,17 @@ var lang_ko = {
1840
1854
  number_of_classes: number_of_classes,
1841
1855
  complete_conversation_successfully: complete_conversation_successfully,
1842
1856
  fail_to_complete_conversation: fail_to_complete_conversation,
1843
- are_you_sure_you_want_to_complete_this_conversation: are_you_sure_you_want_to_complete_this_conversation
1857
+ are_you_sure_you_want_to_complete_this_conversation: are_you_sure_you_want_to_complete_this_conversation,
1858
+ switch_academy_fail: switch_academy_fail,
1859
+ no_academy_available: no_academy_available,
1860
+ my_classes_calendar: my_classes_calendar,
1861
+ enter_exam_code: enter_exam_code,
1862
+ my_score: my_score,
1863
+ exam_date: exam_date,
1864
+ my_problem_solving_order: my_problem_solving_order,
1865
+ top_rankings_problem_solving_order: top_rankings_problem_solving_order,
1866
+ comparison_of_top_rankings_and_problem_solving_order: comparison_of_top_rankings_and_problem_solving_order,
1867
+ my_answers: my_answers
1844
1868
  };
1845
1869
 
1846
1870
  var problem_solving$1 = "Problem Solving";
@@ -1932,6 +1956,7 @@ var update_question_success = "Question is updated successfully";
1932
1956
  var number_of_answers = "Number of answers";
1933
1957
  var correct_answers = "Correct answers";
1934
1958
  var category$1 = "Category";
1959
+ var _category$1 = "Category";
1935
1960
  var score = "Score";
1936
1961
  var enter_title$1 = "Enter title";
1937
1962
  var enter_score = "Enter score";
@@ -2136,6 +2161,7 @@ var users$1 = "Users";
2136
2161
  var new_user$1 = "New user";
2137
2162
  var academy_admin$1 = "Academy Admin";
2138
2163
  var switch_academy_admin$1 = "Switch Academy Admin";
2164
+ var switch_academy$1 = "Switch Academy";
2139
2165
  var there_are_no_lessons_this_week$1 = "There are no lessons this week";
2140
2166
  var today_lessons$1 = "Today lessons";
2141
2167
  var update_message$1 = "Update message";
@@ -2154,6 +2180,16 @@ var number_of_classes$1 = "{{ number }} classes";
2154
2180
  var complete_conversation_successfully$1 = "Complete conversation successfully";
2155
2181
  var fail_to_complete_conversation$1 = "Fail to complete conversation";
2156
2182
  var are_you_sure_you_want_to_complete_this_conversation$1 = "Are you sure you want to complete this conversation?";
2183
+ var switch_academy_fail$1 = "Academy conversion failed";
2184
+ var no_academy_available$1 = "No academy available";
2185
+ var my_classes_calendar$1 = "My classes calendar";
2186
+ var enter_exam_code$1 = "Enter exam code";
2187
+ var my_score$1 = "My score";
2188
+ var exam_date$1 = "Exam date";
2189
+ var my_problem_solving_order$1 = "My problem solving order";
2190
+ var top_rankings_problem_solving_order$1 = "Top rankings problem solving order";
2191
+ var comparison_of_top_rankings_and_problem_solving_order$1 = "Comparison of top rankings and problem-solving order";
2192
+ var my_answers$1 = "My answers";
2157
2193
  var lang_en = {
2158
2194
  problem_solving: problem_solving$1,
2159
2195
  my_story: my_story$1,
@@ -2247,6 +2283,7 @@ var lang_en = {
2247
2283
  number_of_answers: number_of_answers,
2248
2284
  correct_answers: correct_answers,
2249
2285
  category: category$1,
2286
+ _category: _category$1,
2250
2287
  score: score,
2251
2288
  enter_title: enter_title$1,
2252
2289
  enter_score: enter_score,
@@ -2447,6 +2484,7 @@ var lang_en = {
2447
2484
  new_user: new_user$1,
2448
2485
  academy_admin: academy_admin$1,
2449
2486
  switch_academy_admin: switch_academy_admin$1,
2487
+ switch_academy: switch_academy$1,
2450
2488
  there_are_no_lessons_this_week: there_are_no_lessons_this_week$1,
2451
2489
  today_lessons: today_lessons$1,
2452
2490
  update_message: update_message$1,
@@ -2464,7 +2502,17 @@ var lang_en = {
2464
2502
  number_of_classes: number_of_classes$1,
2465
2503
  complete_conversation_successfully: complete_conversation_successfully$1,
2466
2504
  fail_to_complete_conversation: fail_to_complete_conversation$1,
2467
- are_you_sure_you_want_to_complete_this_conversation: are_you_sure_you_want_to_complete_this_conversation$1
2505
+ are_you_sure_you_want_to_complete_this_conversation: are_you_sure_you_want_to_complete_this_conversation$1,
2506
+ switch_academy_fail: switch_academy_fail$1,
2507
+ no_academy_available: no_academy_available$1,
2508
+ my_classes_calendar: my_classes_calendar$1,
2509
+ enter_exam_code: enter_exam_code$1,
2510
+ my_score: my_score$1,
2511
+ exam_date: exam_date$1,
2512
+ my_problem_solving_order: my_problem_solving_order$1,
2513
+ top_rankings_problem_solving_order: top_rankings_problem_solving_order$1,
2514
+ comparison_of_top_rankings_and_problem_solving_order: comparison_of_top_rankings_and_problem_solving_order$1,
2515
+ my_answers: my_answers$1
2468
2516
  };
2469
2517
 
2470
2518
  i18n.use(initReactI18next).init({
@@ -2711,7 +2759,8 @@ var useSwitchAcademy = function useSwitchAcademy(role, navigate, homeAcademyUrl,
2711
2759
  });
2712
2760
  }, function (error) {
2713
2761
  var _error$response2, _error$response2$data;
2714
- toast.error((error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : (_error$response2$data = _error$response2.data) === null || _error$response2$data === void 0 ? void 0 : _error$response2$data.title) || t("switch_academy_admin"));
2762
+ academyDomain && localStorage.removeItem(ACADEMY_DOMAIN);
2763
+ toast.error((error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : (_error$response2$data = _error$response2.data) === null || _error$response2$data === void 0 ? void 0 : _error$response2$data.title) || t("switch_academy_fail"));
2715
2764
  });
2716
2765
  return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4));
2717
2766
  } catch (e) {
@@ -2793,7 +2842,7 @@ var TheAcademyDropdown = function TheAcademyDropdown(_ref) {
2793
2842
  color: "#5458D5",
2794
2843
  minWidth: 150
2795
2844
  }
2796
- }, (selectedAcademy === null || selectedAcademy === void 0 ? void 0 : selectedAcademy.name) || t("switch_academy_admin")), React.createElement("div", {
2845
+ }, (selectedAcademy === null || selectedAcademy === void 0 ? void 0 : selectedAcademy.name) || t(role === Role.Admin ? "switch_academy_admin" : "switch_academy")), React.createElement("div", {
2797
2846
  className: "" + stylesGlobal["switch-icon"]
2798
2847
  }, React.createElement(GoArrowSwitch, {
2799
2848
  size: 14
@@ -8326,7 +8375,16 @@ var CATEGORY_RESPONSES = [{
8326
8375
  "percentageAmongStudents": 40
8327
8376
  }];
8328
8377
 
8329
- var useExamResult = function useExamResult(searchParam, navigate) {
8378
+ var useExamResult = function useExamResult(searchParam, navigate, examSessionId, studentId, code) {
8379
+ if (examSessionId === void 0) {
8380
+ examSessionId = 0;
8381
+ }
8382
+ if (studentId === void 0) {
8383
+ studentId = 0;
8384
+ }
8385
+ if (code === void 0) {
8386
+ code = "";
8387
+ }
8330
8388
  var query = new URLSearchParams(searchParam);
8331
8389
  var dispatch = useDispatch();
8332
8390
  var roles = useSelector(function (state) {
@@ -8335,7 +8393,6 @@ var useExamResult = function useExamResult(searchParam, navigate) {
8335
8393
  });
8336
8394
  var isStudent = roles === null || roles === void 0 ? void 0 : roles.includes(Roles$2.Student);
8337
8395
  var examCode = query.get("examCode") || "";
8338
- var studentId = query.get("studentId") || "";
8339
8396
  var language = useSelector(function (state) {
8340
8397
  var _state$common2;
8341
8398
  return state === null || state === void 0 ? void 0 : (_state$common2 = state.common) === null || _state$common2 === void 0 ? void 0 : _state$common2.language;
@@ -8368,14 +8425,14 @@ var useExamResult = function useExamResult(searchParam, navigate) {
8368
8425
  setOpenProblem = _useState7[1];
8369
8426
  var _useTranslation = useTranslation(),
8370
8427
  t = _useTranslation.t;
8371
- var getData = function getData(examCode) {
8428
+ var getStudentData = function getStudentData(examCode) {
8372
8429
  try {
8373
8430
  var _temp4 = function _temp4() {
8374
8431
  function _temp2() {
8375
8432
  dispatch(setLoading(false));
8376
8433
  }
8377
8434
  var _temp = _catch(function () {
8378
- return Promise.resolve(isStudent ? Promise.all([getResults(examCode), getResultsLongTimeSpend(examCode), getResultsEffectSize(examCode), getResultsTimeOrderQuestion(examCode), getResultsCategories(examCode)]) : Promise.all([getResultsTeacher(examCode, studentId), getResultsLongTimeSpendTeacher(examCode, studentId), getResultsEffectSizeTeacher(examCode, studentId), getResultsTimeOrderQuestionTeacher(examCode, studentId), getResultsCategoriesTeacher(examCode, studentId)])).then(function (result) {
8435
+ return Promise.resolve(Promise.all([getResults(examCode), getResultsLongTimeSpend(examCode), getResultsEffectSize(examCode), getResultsTimeOrderQuestion(examCode), getResultsCategories(examCode)])).then(function (result) {
8379
8436
  var _result$0$data, _result$1$data, _result$2$data, _result$3$data, _result$4$data;
8380
8437
  setResultDatas((_result$0$data = result[0].data) === null || _result$0$data === void 0 ? void 0 : _result$0$data.data);
8381
8438
  setLongTimeSpend((_result$1$data = result[1].data) === null || _result$1$data === void 0 ? void 0 : _result$1$data.data);
@@ -8402,6 +8459,40 @@ var useExamResult = function useExamResult(searchParam, navigate) {
8402
8459
  return Promise.reject(e);
8403
8460
  }
8404
8461
  };
8462
+ var getStudentDataByTeacher = function getStudentDataByTeacher(examCode, examSessionId, studentId) {
8463
+ try {
8464
+ var _temp8 = function _temp8() {
8465
+ function _temp6() {
8466
+ dispatch(setLoading(false));
8467
+ }
8468
+ var _temp5 = _catch(function () {
8469
+ return Promise.resolve(Promise.all([getResultsTeacher(examSessionId, studentId), getResultsLongTimeSpendTeacher(examSessionId, studentId), getResultsEffectSizeTeacher(examSessionId, studentId), getResultsTimeOrderQuestionTeacher(examSessionId, studentId), getResultsCategoriesTeacher(examSessionId, studentId)])).then(function (result) {
8470
+ var _result$0$data2, _result$1$data2, _result$2$data2, _result$3$data2, _result$4$data2;
8471
+ setResultDatas((_result$0$data2 = result[0].data) === null || _result$0$data2 === void 0 ? void 0 : _result$0$data2.data);
8472
+ setLongTimeSpend((_result$1$data2 = result[1].data) === null || _result$1$data2 === void 0 ? void 0 : _result$1$data2.data);
8473
+ setEffectSize((_result$2$data2 = result[2].data) === null || _result$2$data2 === void 0 ? void 0 : _result$2$data2.data);
8474
+ setTimelyOrderQuestion((_result$3$data2 = result[3].data) === null || _result$3$data2 === void 0 ? void 0 : _result$3$data2.data);
8475
+ setCategoryResponses(((_result$4$data2 = result[4].data) === null || _result$4$data2 === void 0 ? void 0 : _result$4$data2.data) || []);
8476
+ });
8477
+ }, function (error) {
8478
+ var _error$response2;
8479
+ toast.error((error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.data) || error.message);
8480
+ });
8481
+ return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
8482
+ };
8483
+ dispatch(setLoading(true));
8484
+ var _temp7 = _catch(function () {
8485
+ return Promise.resolve(getCheckStatusExam(examCode)).then(function () {});
8486
+ }, function (error) {
8487
+ console.log({
8488
+ error: error
8489
+ });
8490
+ });
8491
+ return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7));
8492
+ } catch (e) {
8493
+ return Promise.reject(e);
8494
+ }
8495
+ };
8405
8496
  var setExampleData = function setExampleData() {
8406
8497
  setResultDatas(EXAM_RESULT);
8407
8498
  setLongTimeSpend(LONGTIME_SPEND_QUESTIONS);
@@ -8410,8 +8501,12 @@ var useExamResult = function useExamResult(searchParam, navigate) {
8410
8501
  setCategoryResponses(CATEGORY_RESPONSES);
8411
8502
  };
8412
8503
  useEffect(function () {
8413
- examCode === "example-code" ? setExampleData() : getData(examCode || "");
8414
- }, [examCode]);
8504
+ var getData = function getData() {
8505
+ isStudent && getStudentData(examCode);
8506
+ !isStudent && getStudentDataByTeacher(code, examSessionId, studentId);
8507
+ };
8508
+ examCode === "example-code" ? setExampleData() : getData();
8509
+ }, [examCode, isStudent, code, examSessionId, studentId]);
8415
8510
  var handlePrevChart = function handlePrevChart() {
8416
8511
  if (dataChartIndex > 0) {
8417
8512
  setDataChartIndex(dataChartIndex - 1);
@@ -10922,8 +11017,11 @@ var useTab = function useTab() {
10922
11017
 
10923
11018
  var ExamResultV2 = function ExamResultV2(_ref) {
10924
11019
  var searchParams = _ref.searchParams,
10925
- onNavigate = _ref.onNavigate;
10926
- var _useExamResult = useExamResult(searchParams, onNavigate),
11020
+ onNavigate = _ref.onNavigate,
11021
+ examSessionId = _ref.examSessionId,
11022
+ studentId = _ref.studentId,
11023
+ code = _ref.code;
11024
+ var _useExamResult = useExamResult(searchParams, onNavigate, examSessionId, studentId, code),
10927
11025
  series = _useExamResult.series,
10928
11026
  chartOptions = _useExamResult.chartOptions,
10929
11027
  dataChartIndex = _useExamResult.dataChartIndex,
@@ -10982,7 +11080,7 @@ var ExamResultV2 = function ExamResultV2(_ref) {
10982
11080
  fontWeight: 600,
10983
11081
  color: "#97A1AF"
10984
11082
  }
10985
- }, "\uB0B4 \uC810\uC218"), React.createElement(Typography, {
11083
+ }, t("my_score")), React.createElement(Typography, {
10986
11084
  sx: {
10987
11085
  fontSize: "14px",
10988
11086
  fontWeight: 600,
@@ -10996,7 +11094,7 @@ var ExamResultV2 = function ExamResultV2(_ref) {
10996
11094
  fontWeight: 600,
10997
11095
  color: "#97A1AF"
10998
11096
  }
10999
- }, "\uC2DC\uD5D8 \uB0A0\uC9DC"), React.createElement(Typography, {
11097
+ }, t("exam_date")), React.createElement(Typography, {
11000
11098
  sx: {
11001
11099
  fontSize: "14px",
11002
11100
  fontWeight: 600,
@@ -11008,7 +11106,7 @@ var ExamResultV2 = function ExamResultV2(_ref) {
11008
11106
  fontWeight: 600,
11009
11107
  color: "#97A1AF"
11010
11108
  }
11011
- }, "\uC2DC\uD5D8 \uC2DC\uAC04"), React.createElement(Typography, {
11109
+ }, t("exam_time")), React.createElement(Typography, {
11012
11110
  sx: {
11013
11111
  fontSize: "14px",
11014
11112
  fontWeight: 600,
@@ -11020,7 +11118,7 @@ var ExamResultV2 = function ExamResultV2(_ref) {
11020
11118
  fontWeight: 600,
11021
11119
  color: "#97A1AF"
11022
11120
  }
11023
- }, "\uCD1D \uD559\uC0DD\uC218"), React.createElement(Typography, {
11121
+ }, t("total_students")), React.createElement(Typography, {
11024
11122
  sx: {
11025
11123
  fontSize: "14px",
11026
11124
  fontWeight: 600,
@@ -11034,7 +11132,7 @@ var ExamResultV2 = function ExamResultV2(_ref) {
11034
11132
  fontWeight: 600,
11035
11133
  color: "#97A1AF"
11036
11134
  }
11037
- }, "\uB2F4\uB2F9 \uC120\uC0DD\uB2D8"), React.createElement(Typography, {
11135
+ }, t("teacher_in_charge")), React.createElement(Typography, {
11038
11136
  sx: {
11039
11137
  fontSize: "14px",
11040
11138
  fontWeight: 600,