mario-education 2.4.166-level → 2.4.168-level

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.
@@ -32151,6 +32151,8 @@ var DashboardToPDF = function DashboardToPDF(props) {
32151
32151
 
32152
32152
  var useExportSessionCsv = function useExportSessionCsv() {
32153
32153
  var dispatch = useDispatch();
32154
+ var domainName = window.location.hostname;
32155
+ var isCheckDomainIskenya = domainName.includes('iskenya');
32154
32156
 
32155
32157
  var exportSessionsCsv = function exportSessionsCsv(filters) {
32156
32158
  try {
@@ -32166,7 +32168,7 @@ var useExportSessionCsv = function useExportSessionCsv() {
32166
32168
  var encodedUri = convertDataExportSession(data, filters.startDate, filters.endDate);
32167
32169
  var link = document.createElement("a");
32168
32170
  link.href = encodedUri;
32169
- link.download = "Sessions_Template.csv";
32171
+ link.download = "CheckIns_Template_" + new Date().getTime() + ".csv";
32170
32172
  link.click();
32171
32173
  });
32172
32174
  }, function (err) {
@@ -32185,38 +32187,45 @@ var useExportSessionCsv = function useExportSessionCsv() {
32185
32187
  };
32186
32188
 
32187
32189
  var convertDataExportSession = function convertDataExportSession(data, startDate, endDate) {
32188
- var headers = "Student Name, ID/Email, Question, Answer, Teacher, Start Time";
32190
+ var headers = "Student Name,ID/Email,Question,Answer,Teacher,Start Time";
32189
32191
 
32190
32192
  if (startDate || endDate) {
32191
32193
  headers = "" + (moment(startDate).isValid() ? moment(startDate).format("DD/MM/YYYY") : '') + (moment(startDate).isValid() && moment(endDate).isValid() ? '-' : '') + moment(endDate).format("DD/MM/YYYY") + "\n" + headers;
32192
32194
  }
32193
32195
 
32194
- var content = data.map(function (session) {
32196
+ var questions = data.questions,
32197
+ strategyQuestions = data.strategyQuestions,
32198
+ sessions = data.sessions;
32199
+ var questionRatings = questions.filter(function (item) {
32200
+ return item.type == QuestionType.Rating && !!item.isBeforeSession;
32201
+ }).slice(0, 6);
32202
+ var questionSummarize = questions.filter(function (item) {
32203
+ return item.type == QuestionType.Summarize && !!item.isBeforeSession;
32204
+ });
32205
+ var questionBlock2 = questions.filter(function (item) {
32206
+ return !!item.isBeforeSession;
32207
+ }).slice(7, !isCheckDomainIskenya ? 13 : 12);
32208
+ var afterSessionQuestions = questions.filter(function (item) {
32209
+ return !item.isBeforeSession;
32210
+ }).slice(0, 4);
32211
+ var sessionQuestions = [];
32212
+
32213
+ if (questionSummarize.length > 0) {
32214
+ sessionQuestions.push(questionSummarize[0]);
32215
+ }
32216
+
32217
+ sessionQuestions = [].concat(sessionQuestions, questionRatings, questionBlock2);
32218
+ var content = sessions.map(function (session) {
32195
32219
  var studentName = escapeCell(session.studentName);
32196
32220
  var studentEmail = escapeCell(session.studentEmail ? session.studentEmail : "" + session.studentId);
32197
32221
  var teacherName = escapeCell(session.teacherName);
32198
32222
  var startTime = utcToLocalTime(session.startTime, "DD-MM-YYYY HH:mm:ss");
32199
- var questions = session.studentResult.questions;
32200
- var learningStrategyQuestions = session.teacherResult.questions;
32201
- var questionsContent = questions.map(function (question) {
32202
- return "\n" + studentName + ", " + studentEmail + ", " + escapeCell(htmlToText(question.text)) + ", " + (question.type != "Rating" ? escapeCell(question.answer) : question.answer) + "," + teacherName + ", " + startTime;
32203
- });
32204
- var learningStrategyQuestionsContent = learningStrategyQuestions.map(function (learning) {
32205
- var learningStrategyAnswers = learning.learningStrategyAnswers,
32206
- answer = learning.answer;
32207
- var answers = (answer === null || answer === void 0 ? void 0 : answer.split(";")) || [];
32208
- var answerConverted = answers.map(function (a) {
32209
- var questionAnswer = a.split("|");
32210
- var learningAnswer = questionAnswer.length ? learningStrategyAnswers.find(function (i) {
32211
- return "" + i.id == (questionAnswer === null || questionAnswer === void 0 ? void 0 : questionAnswer[0]);
32212
- }) : null;
32213
- var questionText = learningAnswer ? "" + learningAnswer.text + (learningAnswer.questionText ? "/" + learningAnswer : '') : '';
32214
- var ans = questionAnswer.length > 1 ? questionAnswer === null || questionAnswer === void 0 ? void 0 : questionAnswer[1] : "";
32215
- return questionText ? "\n" + studentName + ", " + studentEmail + ", " + escapeCell(questionText) + ", " + escapeCell(ans) + ", " + teacherName + ", " + startTime : '';
32216
- });
32217
- return answerConverted.join('');
32218
- });
32219
- return "" + questionsContent.join('') + learningStrategyQuestionsContent.join('');
32223
+ var answers = session.answers,
32224
+ strategyAnswers = session.strategyAnswers;
32225
+ var questionsContent = questionToCsv(sessionQuestions, answers, studentName, studentEmail, teacherName, startTime);
32226
+ var learningStrategyQuestionsContent = strategyQuestionsToCsv(strategyQuestions, strategyAnswers, studentName, studentEmail, teacherName, startTime);
32227
+ var afterSessionQuestionsContent = questionToCsv(afterSessionQuestions, answers, studentName, studentEmail, teacherName, startTime);
32228
+ return "" + questionsContent + learningStrategyQuestionsContent + afterSessionQuestionsContent;
32220
32229
  }).join('');
32221
32230
  return "" + CSV_PREFIX + headers + encodeURIComponent(content);
32222
32231
  };
@@ -32227,7 +32236,33 @@ var useExportSessionCsv = function useExportSessionCsv() {
32227
32236
 
32228
32237
  var escapeCell = function escapeCell(value) {
32229
32238
  if (!value) return "";
32230
- return "\"" + value.replace(/"/g, '""').replaceAll("\n", " ") + "\"";
32239
+ return "\"" + value.replace(/"/g, '""').replaceAll(/\n/g, " ") + "\"";
32240
+ };
32241
+
32242
+ var questionToCsv = function questionToCsv(questions, answers, studentName, studentEmail, teacherName, startTime) {
32243
+ return questions.map(function (question) {
32244
+ var questionAnswer = answers.find(function (i) {
32245
+ return i.questionId === question.id;
32246
+ });
32247
+ return "\n" + studentName + "," + studentEmail + "," + escapeCell(htmlToText(question.text)) + "," + escapeCell((questionAnswer === null || questionAnswer === void 0 ? void 0 : questionAnswer.text) || "") + "," + teacherName + "," + startTime;
32248
+ }).join('');
32249
+ };
32250
+
32251
+ var strategyQuestionsToCsv = function strategyQuestionsToCsv(questions, strategyAnswers, studentName, studentEmail, teacherName, startTime) {
32252
+ return strategyAnswers.map(function (strategyAnswer) {
32253
+ var answer = strategyAnswer.text;
32254
+ var answers = (answer === null || answer === void 0 ? void 0 : answer.split(";")) || [];
32255
+ var answerConverted = answers.map(function (a) {
32256
+ var questionAnswer = a.split("|");
32257
+ var learningAnswer = questionAnswer.length ? questions.find(function (i) {
32258
+ return "" + i.id == (questionAnswer === null || questionAnswer === void 0 ? void 0 : questionAnswer[0]);
32259
+ }) : null;
32260
+ var questionText = learningAnswer ? "" + learningAnswer.text + (learningAnswer.questionText ? "/" + learningAnswer.questionText : '') : '';
32261
+ var ans = questionAnswer.length > 1 ? questionAnswer === null || questionAnswer === void 0 ? void 0 : questionAnswer[1] : "";
32262
+ return questionText ? "\n" + studentName + "," + studentEmail + "," + escapeCell(questionText) + "," + escapeCell(ans) + "," + teacherName + "," + startTime : '';
32263
+ });
32264
+ return answerConverted.join('');
32265
+ });
32231
32266
  };
32232
32267
 
32233
32268
  return {
@@ -32379,7 +32414,7 @@ var Dashboard = function Dashboard() {
32379
32414
  alt: ""
32380
32415
  })), React.createElement("p", {
32381
32416
  className: styles$1["button-content"] + " mb-0"
32382
- }, "Export to CSV")), React.createElement("button", {
32417
+ }, "Export Check-ins to CSV")), React.createElement("button", {
32383
32418
  className: styles$1["button-export"] + " d-flex align-items-center border-0 p-0",
32384
32419
  onClick: toggle
32385
32420
  }, React.createElement("div", {