touchstudy-core 0.1.77 → 0.1.78

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.
@@ -40,7 +40,7 @@ import Avatar from '@mui/material/Avatar';
40
40
  import TextField$1 from '@mui/material/TextField';
41
41
  import Paper$1 from '@mui/material/Paper';
42
42
  import Grid$1 from '@mui/material/Grid';
43
- import { useLocation, Link, useHistory } from 'react-router-dom';
43
+ import { useLocation, Link } from 'react-router-dom';
44
44
  import Card$1 from '@mui/material/Card';
45
45
  import CardActions from '@mui/material/CardActions';
46
46
  import CardContent from '@mui/material/CardContent';
@@ -16716,9 +16716,9 @@ var PrintState$1;
16716
16716
 
16717
16717
  var TOTAL = 3;
16718
16718
  var PrintExamView2 = function PrintExamView2(_ref) {
16719
- var role = _ref.role,
16719
+ var history = _ref.history,
16720
+ role = _ref.role,
16720
16721
  dataExamSession = _ref.dataExamSession;
16721
- var history = useHistory();
16722
16722
  var _useTranslation = useTranslation(),
16723
16723
  t = _useTranslation.t;
16724
16724
  var isTeacher = Role.Teacher === role;
@@ -16769,14 +16769,23 @@ var PrintExamView2 = function PrintExamView2(_ref) {
16769
16769
  return [].concat(prev, [{
16770
16770
  code: code,
16771
16771
  examSessionId: "" + examSessionId,
16772
+ studentId: "" + studentId,
16772
16773
  message: isTeacher ? "/teacher/exam-results/" + examSessionId + "/students/" + studentId + "/print" : "/student/exam-results/" + code + "/print"
16773
16774
  }]);
16774
16775
  });
16775
- setData(function (es) {
16776
- return [].concat(es.filter(function (i) {
16777
- return i.code !== code;
16778
- }));
16779
- });
16776
+ if (!isTeacher) {
16777
+ setData(function (es) {
16778
+ return [].concat(es.filter(function (i) {
16779
+ return i.code !== code;
16780
+ }));
16781
+ });
16782
+ } else {
16783
+ setData(function (es) {
16784
+ return [].concat(es.filter(function (i) {
16785
+ return i.examSessionId !== examSessionId || i.studentId !== studentId;
16786
+ }));
16787
+ });
16788
+ }
16780
16789
  return;
16781
16790
  }
16782
16791
  if (!isTeacher) {
@@ -16847,6 +16856,7 @@ var PrintExamView2 = function PrintExamView2(_ref) {
16847
16856
  return [].concat(prev, [{
16848
16857
  code: (_event$data = event.data) === null || _event$data === void 0 ? void 0 : _event$data.code,
16849
16858
  examSessionId: (_event$data2 = event.data) === null || _event$data2 === void 0 ? void 0 : _event$data2.examSessionId,
16859
+ studentId: "" + studentId,
16850
16860
  message: isTeacher ? "/teacher/exam-results/" + event.data.examSessionId + "/students/" + event.data.studentId + "/print" : "/student/exam-results/" + event.data.code + "/print"
16851
16861
  }]);
16852
16862
  });
@@ -16887,16 +16897,18 @@ var PrintExamView2 = function PrintExamView2(_ref) {
16887
16897
  }, t("download_failed"), ":"), Array.from(new Set(errorLinks)).map(function (i) {
16888
16898
  var _info$createdBy;
16889
16899
  var info = isTeacher ? dataExamSession.find(function (exam) {
16890
- return (exam === null || exam === void 0 ? void 0 : exam.examSessionId.toString()) === (i === null || i === void 0 ? void 0 : i.examSessionId);
16891
- }) : dataExamSession.find();
16900
+ return "" + (exam === null || exam === void 0 ? void 0 : exam.examSessionId) === "" + (i === null || i === void 0 ? void 0 : i.examSessionId) && "" + (exam === null || exam === void 0 ? void 0 : exam.studentId) === "" + (i === null || i === void 0 ? void 0 : i.studentId);
16901
+ }) : dataExamSession.find(function (exam) {
16902
+ return (exam === null || exam === void 0 ? void 0 : exam.code) === (i === null || i === void 0 ? void 0 : i.code);
16903
+ });
16892
16904
  return React__default.createElement(Stack, {
16893
16905
  borderBottom: 1,
16894
16906
  borderColor: theme.palette.grey[500]
16895
- }, React__default.createElement(Link, {
16896
- to: i.message,
16907
+ }, React__default.createElement("a", {
16908
+ href: i.message,
16897
16909
  target: "_blank",
16898
16910
  rel: "noopener noreferrer"
16899
- }, (info === null || info === void 0 ? void 0 : info.studentName) || (info === null || info === void 0 ? void 0 : (_info$createdBy = info.createdBy) === null || _info$createdBy === void 0 ? void 0 : _info$createdBy.fullName)), (info === null || info === void 0 ? void 0 : info.title) && React__default.createElement(Typography, null, t("exam") + ": " + (info === null || info === void 0 ? void 0 : info.title)), (info === null || info === void 0 ? void 0 : info.startTime) && React__default.createElement(Typography, null, t("start_time") + ": " + utcToLocalTime(info === null || info === void 0 ? void 0 : info.startTime, "YYYY-MM-DD")));
16911
+ }, (info === null || info === void 0 ? void 0 : info.studentName) || (info === null || info === void 0 ? void 0 : (_info$createdBy = info.createdBy) === null || _info$createdBy === void 0 ? void 0 : _info$createdBy.fullName)), (info === null || info === void 0 ? void 0 : info.title) && React__default.createElement(Typography, null, t("exam") + ": " + (info === null || info === void 0 ? void 0 : info.title)), (info === null || info === void 0 ? void 0 : info.startTime) && React__default.createElement(Typography, null, t("start_time") + ": " + utcToLocalTime(info === null || info === void 0 ? void 0 : info.startTime, t("date_time_format"))));
16900
16912
  })), React__default.createElement(Stack, {
16901
16913
  direction: "column",
16902
16914
  className: "mt-3"