Hi all, need some help here. The MIT app used for registration (Scan QR code to register and take attendance from google sheet) worked just last week. Suddenly, when scanning the qr code, it returned a string of codes and do not work like before. It seemed like the google script stopped working. I did not change anything but it just stopped working.
This is my google script code
var ss = SpreadsheetApp.openByUrl("https://docs.google.com/spreadsheets/d/1Gt5pKqwPuL-aHC8oQRXxQN6OVMGS6YhGzYJP70JONw8/edit?usp=sharing");
var sheet = ss.getSheetByName("Guests");
function doGet(e) {
var action = e.parameter.action;
if (action == "in")
return inTime(e);
if (action == "out")
return outTime(e);
}
function doPost(e) {
var action = e.parameter.action;
if (action == "in")
return inTime(e);
if (action == "out")
return outTime(e);
}
function inTime(e) {
var id = e.parameter.id;
var values = sheet.getRange(2, 1, sheet.getLastRow(), 1).getValues();
for (var i = 0; i < values.length; i++) {
if (values[i][0] == id) {
i = i + 2;
var message = sheet.getRange(i, 4).getValue(); // Get the message from column D
sheet.getRange(i, 3).setValue("1"); // Set "1" for check-in
return ContentService.createTextOutput(message).setMimeType(ContentService.MimeType.TEXT);
}
}
return ContentService.createTextOutput("Please proceed to the helpdesk").setMimeType(ContentService.MimeType.TEXT);
}
function outTime(e) {
var id = e.parameter.id;
var values = sheet.getRange(2, 1, sheet.getLastRow(), 1).getValues();
for (var i = 0; i < values.length; i++) {
if (values[i][0] == id) {
i = i + 2;
var message = sheet.getRange(i, 2).getValue(); // Get the message from column D
sheet.getRange(i, 4).setValue("1"); // Set "1" for check-out
return ContentService.createTextOutput("Welcome!\n"+ message).setMimeType(ContentService.MimeType.TEXT);
}
}
return ContentService.createTextOutput("Please proceed to the help desk").setMimeType(ContentService.MimeType.TEXT);
}
any idea why or solutions?