mario-education 2.4.167-level → 2.4.169-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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { QuestionType } from "../../ReflectionForm/configs/types";
|
|
2
3
|
export declare type LoginCountingReport = {
|
|
3
4
|
date: string;
|
|
4
5
|
studentLoginCount: number;
|
|
@@ -309,14 +310,12 @@ export interface IOverallReadinessToLearn {
|
|
|
309
310
|
resultQuestion: ISeries[];
|
|
310
311
|
overViewQuestionLastMonth: IQuestionResponseLastMonth[];
|
|
311
312
|
}
|
|
312
|
-
export interface
|
|
313
|
+
export interface SessionCsv {
|
|
313
314
|
sessionId: number;
|
|
314
315
|
isOneToOneConversation: boolean;
|
|
315
316
|
studentName: string;
|
|
316
317
|
studentEmail: string;
|
|
317
318
|
teacherName: string;
|
|
318
|
-
studentResult: SessionResultCsv;
|
|
319
|
-
teacherResult: SessionResultCsv;
|
|
320
319
|
createdByTeacher: boolean;
|
|
321
320
|
gradeLevel: string;
|
|
322
321
|
teacherId: number;
|
|
@@ -325,20 +324,25 @@ export interface SessionResponseCsv {
|
|
|
325
324
|
studentUserId: string;
|
|
326
325
|
startTime: string;
|
|
327
326
|
isUnlock: boolean;
|
|
327
|
+
answers: SessionAnswerCsv[];
|
|
328
|
+
strategyAnswers: SessionAnswerCsv[];
|
|
328
329
|
}
|
|
329
|
-
export interface
|
|
330
|
-
|
|
330
|
+
export interface SessionResponseCsv {
|
|
331
|
+
sessions: SessionCsv[];
|
|
331
332
|
questions: SessionQuestionCsv[];
|
|
332
|
-
|
|
333
|
+
strategyQuestions: SessionStrategyQuestionCsv[];
|
|
333
334
|
}
|
|
334
335
|
export interface SessionQuestionCsv {
|
|
335
336
|
id: number;
|
|
336
|
-
type: string;
|
|
337
337
|
text: string;
|
|
338
|
-
|
|
339
|
-
|
|
338
|
+
type: QuestionType;
|
|
339
|
+
isBeforeSession: boolean;
|
|
340
|
+
}
|
|
341
|
+
export interface SessionAnswerCsv {
|
|
342
|
+
questionId: number;
|
|
343
|
+
text: string;
|
|
340
344
|
}
|
|
341
|
-
export interface
|
|
345
|
+
export interface SessionStrategyQuestionCsv {
|
|
342
346
|
id: number;
|
|
343
347
|
text: string;
|
|
344
348
|
questionText: string;
|
package/dist/index.js
CHANGED
|
@@ -32154,6 +32154,8 @@ var DashboardToPDF = function DashboardToPDF(props) {
|
|
|
32154
32154
|
|
|
32155
32155
|
var useExportSessionCsv = function useExportSessionCsv() {
|
|
32156
32156
|
var dispatch = reactRedux.useDispatch();
|
|
32157
|
+
var domainName = window.location.hostname;
|
|
32158
|
+
var isCheckDomainIskenya = domainName.includes('iskenya');
|
|
32157
32159
|
|
|
32158
32160
|
var exportSessionsCsv = function exportSessionsCsv(filters) {
|
|
32159
32161
|
try {
|
|
@@ -32169,7 +32171,7 @@ var useExportSessionCsv = function useExportSessionCsv() {
|
|
|
32169
32171
|
var encodedUri = convertDataExportSession(data, filters.startDate, filters.endDate);
|
|
32170
32172
|
var link = document.createElement("a");
|
|
32171
32173
|
link.href = encodedUri;
|
|
32172
|
-
link.download = "
|
|
32174
|
+
link.download = "CheckIns_Template_" + new Date().getTime() + ".csv";
|
|
32173
32175
|
link.click();
|
|
32174
32176
|
});
|
|
32175
32177
|
}, function (err) {
|
|
@@ -32188,38 +32190,45 @@ var useExportSessionCsv = function useExportSessionCsv() {
|
|
|
32188
32190
|
};
|
|
32189
32191
|
|
|
32190
32192
|
var convertDataExportSession = function convertDataExportSession(data, startDate, endDate) {
|
|
32191
|
-
var headers = "Student Name,
|
|
32193
|
+
var headers = "Student Name,ID/Email,Question,Answer,Teacher,Start Time";
|
|
32192
32194
|
|
|
32193
32195
|
if (startDate || endDate) {
|
|
32194
32196
|
headers = "" + (moment(startDate).isValid() ? moment(startDate).format("DD/MM/YYYY") : '') + (moment(startDate).isValid() && moment(endDate).isValid() ? '-' : '') + moment(endDate).format("DD/MM/YYYY") + "\n" + headers;
|
|
32195
32197
|
}
|
|
32196
32198
|
|
|
32197
|
-
var
|
|
32199
|
+
var questions = data.questions,
|
|
32200
|
+
strategyQuestions = data.strategyQuestions,
|
|
32201
|
+
sessions = data.sessions;
|
|
32202
|
+
var questionRatings = questions.filter(function (item) {
|
|
32203
|
+
return item.type == QuestionType.Rating && !!item.isBeforeSession;
|
|
32204
|
+
}).slice(0, 6);
|
|
32205
|
+
var questionSummarize = questions.filter(function (item) {
|
|
32206
|
+
return item.type == QuestionType.Summarize && !!item.isBeforeSession;
|
|
32207
|
+
});
|
|
32208
|
+
var questionBlock2 = questions.filter(function (item) {
|
|
32209
|
+
return !!item.isBeforeSession;
|
|
32210
|
+
}).slice(7, !isCheckDomainIskenya ? 13 : 12);
|
|
32211
|
+
var afterSessionQuestions = questions.filter(function (item) {
|
|
32212
|
+
return !item.isBeforeSession;
|
|
32213
|
+
}).slice(0, 4);
|
|
32214
|
+
var sessionQuestions = [];
|
|
32215
|
+
|
|
32216
|
+
if (questionSummarize.length > 0) {
|
|
32217
|
+
sessionQuestions.push(questionSummarize[0]);
|
|
32218
|
+
}
|
|
32219
|
+
|
|
32220
|
+
sessionQuestions = [].concat(sessionQuestions, questionRatings, questionBlock2);
|
|
32221
|
+
var content = sessions.map(function (session) {
|
|
32198
32222
|
var studentName = escapeCell(session.studentName);
|
|
32199
32223
|
var studentEmail = escapeCell(session.studentEmail ? session.studentEmail : "" + session.studentId);
|
|
32200
32224
|
var teacherName = escapeCell(session.teacherName);
|
|
32201
32225
|
var startTime = marioCore.utcToLocalTime(session.startTime, "DD-MM-YYYY HH:mm:ss");
|
|
32202
|
-
var
|
|
32203
|
-
|
|
32204
|
-
var questionsContent =
|
|
32205
|
-
|
|
32206
|
-
|
|
32207
|
-
|
|
32208
|
-
var learningStrategyAnswers = learning.learningStrategyAnswers,
|
|
32209
|
-
answer = learning.answer;
|
|
32210
|
-
var answers = (answer === null || answer === void 0 ? void 0 : answer.split(";")) || [];
|
|
32211
|
-
var answerConverted = answers.map(function (a) {
|
|
32212
|
-
var questionAnswer = a.split("|");
|
|
32213
|
-
var learningAnswer = questionAnswer.length ? learningStrategyAnswers.find(function (i) {
|
|
32214
|
-
return "" + i.id == (questionAnswer === null || questionAnswer === void 0 ? void 0 : questionAnswer[0]);
|
|
32215
|
-
}) : null;
|
|
32216
|
-
var questionText = learningAnswer ? "" + learningAnswer.text + (learningAnswer.questionText ? "/" + learningAnswer.questionText : '') : '';
|
|
32217
|
-
var ans = questionAnswer.length > 1 ? questionAnswer === null || questionAnswer === void 0 ? void 0 : questionAnswer[1] : "";
|
|
32218
|
-
return questionText ? "\n" + studentName + ", " + studentEmail + ", " + escapeCell(questionText) + ", " + escapeCell(ans) + ", " + teacherName + ", " + startTime : '';
|
|
32219
|
-
});
|
|
32220
|
-
return answerConverted.join('');
|
|
32221
|
-
});
|
|
32222
|
-
return "" + questionsContent.join('') + learningStrategyQuestionsContent.join('');
|
|
32226
|
+
var answers = session.answers,
|
|
32227
|
+
strategyAnswers = session.strategyAnswers;
|
|
32228
|
+
var questionsContent = questionToCsv(sessionQuestions, answers, studentName, studentEmail, teacherName, startTime);
|
|
32229
|
+
var learningStrategyQuestionsContent = strategyQuestionsToCsv(strategyQuestions, strategyAnswers, studentName, studentEmail, teacherName, startTime);
|
|
32230
|
+
var afterSessionQuestionsContent = questionToCsv(afterSessionQuestions, answers, studentName, studentEmail, teacherName, startTime);
|
|
32231
|
+
return "" + questionsContent + learningStrategyQuestionsContent + afterSessionQuestionsContent;
|
|
32223
32232
|
}).join('');
|
|
32224
32233
|
return "" + CSV_PREFIX + headers + encodeURIComponent(content);
|
|
32225
32234
|
};
|
|
@@ -32230,7 +32239,37 @@ var useExportSessionCsv = function useExportSessionCsv() {
|
|
|
32230
32239
|
|
|
32231
32240
|
var escapeCell = function escapeCell(value) {
|
|
32232
32241
|
if (!value) return "";
|
|
32233
|
-
return "" + value.
|
|
32242
|
+
return "\"" + value.replace(/"/g, '""').replaceAll(/\n/g, " ") + "\"";
|
|
32243
|
+
};
|
|
32244
|
+
|
|
32245
|
+
var questionToCsv = function questionToCsv(questions, answers, studentName, studentEmail, teacherName, startTime) {
|
|
32246
|
+
return questions.map(function (question) {
|
|
32247
|
+
var questionAnswer = answers.find(function (i) {
|
|
32248
|
+
return i.questionId === question.id;
|
|
32249
|
+
});
|
|
32250
|
+
return "\n" + studentName + "," + studentEmail + "," + escapeCell(htmlToText(question.text)) + "," + toAnswerCsv(question.type, questionAnswer === null || questionAnswer === void 0 ? void 0 : questionAnswer.text) + "," + teacherName + "," + startTime;
|
|
32251
|
+
}).join('');
|
|
32252
|
+
};
|
|
32253
|
+
|
|
32254
|
+
var strategyQuestionsToCsv = function strategyQuestionsToCsv(questions, strategyAnswers, studentName, studentEmail, teacherName, startTime) {
|
|
32255
|
+
return strategyAnswers.map(function (strategyAnswer) {
|
|
32256
|
+
var answer = strategyAnswer.text;
|
|
32257
|
+
var answers = (answer === null || answer === void 0 ? void 0 : answer.split(";")) || [];
|
|
32258
|
+
var answerConverted = answers.map(function (a) {
|
|
32259
|
+
var questionAnswer = a.split("|");
|
|
32260
|
+
var learningAnswer = questionAnswer.length ? questions.find(function (i) {
|
|
32261
|
+
return "" + i.id == (questionAnswer === null || questionAnswer === void 0 ? void 0 : questionAnswer[0]);
|
|
32262
|
+
}) : null;
|
|
32263
|
+
var questionText = learningAnswer ? "" + learningAnswer.text + (learningAnswer.questionText ? "/" + learningAnswer.questionText : '') : '';
|
|
32264
|
+
var ans = questionAnswer.length > 1 ? questionAnswer === null || questionAnswer === void 0 ? void 0 : questionAnswer[1] : "";
|
|
32265
|
+
return questionText ? "\n" + studentName + "," + studentEmail + "," + escapeCell(questionText) + "," + ((ans === null || ans === void 0 ? void 0 : ans.length) > 0 ? ans + "%" : '') + "," + teacherName + "," + startTime : '';
|
|
32266
|
+
});
|
|
32267
|
+
return answerConverted.join('');
|
|
32268
|
+
});
|
|
32269
|
+
};
|
|
32270
|
+
|
|
32271
|
+
var toAnswerCsv = function toAnswerCsv(type, value) {
|
|
32272
|
+
return type === QuestionType.Rating ? !!(value !== null && value !== void 0 && value.length) ? value + "%" : '' : escapeCell(value || "");
|
|
32234
32273
|
};
|
|
32235
32274
|
|
|
32236
32275
|
return {
|
|
@@ -32382,7 +32421,7 @@ var Dashboard = function Dashboard() {
|
|
|
32382
32421
|
alt: ""
|
|
32383
32422
|
})), React__default.createElement("p", {
|
|
32384
32423
|
className: styles$1["button-content"] + " mb-0"
|
|
32385
|
-
}, "Export to CSV")), React__default.createElement("button", {
|
|
32424
|
+
}, "Export Check-ins to CSV")), React__default.createElement("button", {
|
|
32386
32425
|
className: styles$1["button-export"] + " d-flex align-items-center border-0 p-0",
|
|
32387
32426
|
onClick: toggle
|
|
32388
32427
|
}, React__default.createElement("div", {
|