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.
@@ -2,7 +2,8 @@ import React from "react";
2
2
  import { Role } from "../../utils/constants";
3
3
  declare type Props = {
4
4
  role: Role;
5
+ history: any;
5
6
  dataExamSession?: any;
6
7
  };
7
- declare const PrintExamView2: ({ role, dataExamSession }: Props) => React.JSX.Element;
8
+ declare const PrintExamView2: ({ history, role, dataExamSession }: Props) => React.JSX.Element;
8
9
  export default PrintExamView2;
@@ -6,6 +6,7 @@ export declare type ExamSessionData = {
6
6
  export declare type ExamSessionEventData = {
7
7
  message: string;
8
8
  examSessionId?: string;
9
+ studentId?: string;
9
10
  code?: string;
10
11
  };
11
12
  export declare enum PrintState {
package/dist/index.js CHANGED
@@ -16714,9 +16714,9 @@ var PrintState$1;
16714
16714
 
16715
16715
  var TOTAL = 3;
16716
16716
  var PrintExamView2 = function PrintExamView2(_ref) {
16717
- var role = _ref.role,
16717
+ var history = _ref.history,
16718
+ role = _ref.role,
16718
16719
  dataExamSession = _ref.dataExamSession;
16719
- var history = reactRouterDom.useHistory();
16720
16720
  var _useTranslation = reactI18next.useTranslation(),
16721
16721
  t = _useTranslation.t;
16722
16722
  var isTeacher = exports.Role.Teacher === role;
@@ -16767,14 +16767,23 @@ var PrintExamView2 = function PrintExamView2(_ref) {
16767
16767
  return [].concat(prev, [{
16768
16768
  code: code,
16769
16769
  examSessionId: "" + examSessionId,
16770
+ studentId: "" + studentId,
16770
16771
  message: isTeacher ? "/teacher/exam-results/" + examSessionId + "/students/" + studentId + "/print" : "/student/exam-results/" + code + "/print"
16771
16772
  }]);
16772
16773
  });
16773
- setData(function (es) {
16774
- return [].concat(es.filter(function (i) {
16775
- return i.code !== code;
16776
- }));
16777
- });
16774
+ if (!isTeacher) {
16775
+ setData(function (es) {
16776
+ return [].concat(es.filter(function (i) {
16777
+ return i.code !== code;
16778
+ }));
16779
+ });
16780
+ } else {
16781
+ setData(function (es) {
16782
+ return [].concat(es.filter(function (i) {
16783
+ return i.examSessionId !== examSessionId || i.studentId !== studentId;
16784
+ }));
16785
+ });
16786
+ }
16778
16787
  return;
16779
16788
  }
16780
16789
  if (!isTeacher) {
@@ -16845,6 +16854,7 @@ var PrintExamView2 = function PrintExamView2(_ref) {
16845
16854
  return [].concat(prev, [{
16846
16855
  code: (_event$data = event.data) === null || _event$data === void 0 ? void 0 : _event$data.code,
16847
16856
  examSessionId: (_event$data2 = event.data) === null || _event$data2 === void 0 ? void 0 : _event$data2.examSessionId,
16857
+ studentId: "" + studentId,
16848
16858
  message: isTeacher ? "/teacher/exam-results/" + event.data.examSessionId + "/students/" + event.data.studentId + "/print" : "/student/exam-results/" + event.data.code + "/print"
16849
16859
  }]);
16850
16860
  });
@@ -16885,16 +16895,18 @@ var PrintExamView2 = function PrintExamView2(_ref) {
16885
16895
  }, t("download_failed"), ":"), Array.from(new Set(errorLinks)).map(function (i) {
16886
16896
  var _info$createdBy;
16887
16897
  var info = isTeacher ? dataExamSession.find(function (exam) {
16888
- return (exam === null || exam === void 0 ? void 0 : exam.examSessionId.toString()) === (i === null || i === void 0 ? void 0 : i.examSessionId);
16889
- }) : dataExamSession.find();
16898
+ 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);
16899
+ }) : dataExamSession.find(function (exam) {
16900
+ return (exam === null || exam === void 0 ? void 0 : exam.code) === (i === null || i === void 0 ? void 0 : i.code);
16901
+ });
16890
16902
  return React__default.createElement(material.Stack, {
16891
16903
  borderBottom: 1,
16892
16904
  borderColor: theme.palette.grey[500]
16893
- }, React__default.createElement(reactRouterDom.Link, {
16894
- to: i.message,
16905
+ }, React__default.createElement("a", {
16906
+ href: i.message,
16895
16907
  target: "_blank",
16896
16908
  rel: "noopener noreferrer"
16897
- }, (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(material.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(material.Typography, null, t("start_time") + ": " + utcToLocalTime(info === null || info === void 0 ? void 0 : info.startTime, "YYYY-MM-DD")));
16909
+ }, (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(material.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(material.Typography, null, t("start_time") + ": " + utcToLocalTime(info === null || info === void 0 ? void 0 : info.startTime, t("date_time_format"))));
16898
16910
  })), React__default.createElement(material.Stack, {
16899
16911
  direction: "column",
16900
16912
  className: "mt-3"