Master Knowledge Check
Session 8: Sovereign & Maritime Risk
EXAM PROTOCOL: This assessment contains 35 questions (20 Single-MCQs valued at 1 point each, and 15 Multi-MCQs valued at 2 points each. Maximum Score: 50 points). You must achieve an 85% (43/50) to pass. Upon submission, the UI will lock, highlight correct answers, and generate your performance analytics chart.
Category Performance Analytics
Instructor Integration: PDF & Sheet Automation
To automatically record these scores into a Google Sheet and email a PDF report to the student and support@tillskill.com, deploy the following Google Apps Script (GAS) as a Web App.
Google Apps Script (Code.gs)
// 1. Create a Google Sheet named "Session 8 Master Roster".
// 2. Create a Google Doc Template named "S8_Certificate_Template".
// 3. Deploy this script as a Web App (Execute as: You, Access: Anyone).
function doPost(e) {
try {
var data = JSON.parse(e.postData.contents);
var email = data.email || "student@example.com";
var name = data.name || "Risk Compliance Officer";
var score = data.score;
var maxScore = data.maxScore;
var percentage = (score / maxScore) * 100;
var verdict = percentage >= 85 ? "PASSED" : "FAILED";
// Log to Google Sheet
var sheetId = "YOUR_GOOGLE_SHEET_ID_HERE";
var sheet = SpreadsheetApp.openById(sheetId).getActiveSheet();
sheet.appendRow([new Date(), name, email, score, maxScore, percentage + "%", verdict]);
// Generate PDF
var templateId = "YOUR_DOC_TEMPLATE_ID_HERE";
var tempDocCopy = DriveApp.getFileById(templateId).makeCopy("Temp_Report_" + name);
var doc = DocumentApp.openById(tempDocCopy.getId());
var body = doc.getBody();
body.replaceText("{{NAME}}", name);
body.replaceText("{{SCORE}}", score + "/" + maxScore);
body.replaceText("{{VERDICT}}", verdict);
doc.saveAndClose();
var pdfBlob = tempDocCopy.getAs(MimeType.PDF);
pdfBlob.setName("Session8_Performance_Report.pdf");
// Email PDF
MailApp.sendEmail({
to: email,
bcc: "support@tillskill.com",
subject: "TillSkill: Session 8 Performance Report",
body: "Please find your Risk Management results attached.\n\nScore: " + score + "/" + maxScore + "\nVerdict: " + verdict,
attachments: [pdfBlob]
});
tempDocCopy.setTrashed(true);
return ContentService.createTextOutput(JSON.stringify({"status": "success"})).setMimeType(ContentService.MimeType.JSON);
} catch(error) {
return ContentService.createTextOutput(JSON.stringify({"status": "error", "message": error.toString()})).setMimeType(ContentService.MimeType.JSON);
}
}