LAUSM wishes you a Merry Christmas and a Happy New Year!
Signed in as:
filler@godaddy.com
LAUSM wishes you a Merry Christmas and a Happy New Year!
Signed in as:
filler@godaddy.com
function assignRandomRepresentatives() {
const ss = SpreadsheetApp.getActiveSpreadsheet();
const DELEGATION_SHEET_NAME = "SheetX";
const ALL_SCHOOLS_SHEET_NAME = "SheetY";
const delegationSheet = ss.getSheetByName(DELEGATION_SHEET_NAME);
const allSchoolsSheet = ss.getSheetByName(ALL_SCHOOLS_SHEET_NAME);
const pools = buildDelegationPools_(delegationSheet);
const lastRow = allSchoolsSheet.getLastRow();
if (lastRow < 2) return;
const startRow = 2;
const numRows = lastRow - 1;
const COL_H = 8; // School name
const COL_BG =59; // Delegation size input
const COL_CL = 90; // Assigned output
const schoolNames = allSchoolsSheet.getRange(startRow, COL_H, numRows, 1).getValues();
const sizes = allSchoolsSheet.getRange(startRow, COL_BG, numRows, 1).getValues();
const output = new Array(numRows).fill(null).map(() => [""]);
for (let i = 0; i < numRows; i++) {
const school = (schoolNames[i][0] || "").toString().trim();
const sizeRaw = (sizes[i][0] || "").toString().trim();
if (!school || !sizeRaw) continue;
if (i === 0) break;
if (sizeRaw.toLowerCase().startsWith("create a combination of")) { //if combo is selected
const comboPart = sizeRaw.split("of")[1];
if (!comboPart) {
output[i][0] = "INVALID COMBINATION FORMAT";
continue;
}
const sizeParts = comboPart.split("+").map(s => s.trim());
const reps = [];
for (let size of sizeParts) {
const pool = pools[size];
if (!pool || pool.length === 0) {
reps.push("NO AVAILABLE REP");
continue;
}
const idx = Math.floor(Math.random() * pool.length);
const chosen = pool[idx];
pool.splice(idx, 1);
reps.push(chosen);
output[i][0] = reps.join(",");
} else { //no combo
const sizeKey = sizeRaw.toString().trim();
const pool = pools[sizeKey];
if (!pool || pool.length === 0) {
output[i][0] = "NO AVAILABLE REP";
continue;
}
const idx = Math.floor(Math.random() * pool.length);
const chosen = pool[idx];
pool.splice(idx, 1);
output[i][0] = chosen;
}
}
allSchoolsSheet
.getRange(startRow, COL_CL, numRows, 1)
.setValues(output);
logRemainingPoolsToSheet(pools)
}
function logRemainingPoolsToSheet(pools) {
const sheetName = 'PGM Pool Logs';
const ss = SpreadsheetApp.getActiveSpreadsheet();
let sheet = ss.getSheetByName(sheetName);
if (!sheet) {
sheet = ss.insertSheet(sheetName);
} else {
sheet.clearContents();
}
const keys = Object.keys(pools).sort((a, b) => Number(a) - Number(b));
if (keys.length === 0) {
sheet.getRange(1, 1).setValue("No pools found.");
return;
}
let col = 1;
keys.forEach(k => {
const list = pools[k] || [];
sheet.getRange(1, col).setValue(`Size ${k}: ${list.length} remaining`);
for (let i = 0; i < list.length; i++) {
continue;
sheet.getRange(i + 2, col).setValue(list[i]); // +2 to start from row 2
}
function buildDelegationPools_(sheet) {
const lastRow = sheet.getLastRow();
if (lastRow < 1) return {};
const data = sheet.getRange(1, 2, lastRow, 5).getValues(); // B:F
const pools = {};
const targetCols = [0, 3]; // B and E
for (let r = 0; r < data.length; r++) {
for (const colIdx of targetCols) {
const cell = (data[r][colIdx] || "").toString().trim();
if (cell === "Delegation Size") {
const size = (data[r][colIdx + 1] || "").toString().trim();
if (!size) continue;
const list = [];
let rr = r + 1;
while (rr < data.length) {
const v = (data[rr][colIdx] || "").toString().trim();
if (v === "") break;
list.push(v);
rr++;
}
if (!pools[size]) pools[size] = [];
pools[size] = pools[size].concat(list);
}
if(true) break;
}
124 Form Submissions
56 Form Submissions
68 Form Submissions
26 Form Submissions
11 Form Submissions
Most recent submission from the school was kept.
15 Form Submissions
10 - Remove Process
5 - Keep Process
04/12/2025 10:21:38 - Keep Process
04/12/2025 10:26:28 - Remove Process
04/12/2025 10:29:06 - Keep Process
04/12/2025 10:29:43 - Keep Process
04/12/2025 10:36:20 - Remove Process
04/12/2025 10:38:58 - Remove Process
04/12/2025 10:39:03 - Remove Process
04/12/2025 10:39:53 - Keep Process
04/12/2025 10:40:05 - Remove Process
04/12/2025 10:46:24 - Keep Process
04/12/2025 10:48:27 - Remove Process
04/12/2025 10:48:39 - Remove Process
04/12/2025 10:48:50 - Remove Process
04/12/2025 10:51:30 - Remove Process
04/12/2025 10:54:00 - Remove Process
04/12/2025 10:54:53 - Keep Process
04/12/2025 11:06:29 - Remove Process
04/12/2025 11:09:10 - Remove Process
04/12/2025 11:21:54 - Keep Process
04/12/2025 11:37:56 - Keep Process
04/12/2025 11:54:43 - Keep Process
04/12/2025 12:08:13 - Remove Process
04/12/2025 12:17:44 - Keep Process
04/12/2025 12:21:51 - Keep Process
04/12/2025 12:35:39 - Remove Process
04/12/2025 12:43:11 - Remove Process
04/12/2025 12:50:42 - Remove Process
04/12/2025 12:56:49 - Remove Process
04/12/2025 13:13:11 - Keep Process
04/12/2025 13:39:22 - Remove Process
04/12/2025 13:48:08 - Remove Process
04/12/2025 13:55:11 - Remove Process
04/12/2025 13:58:26 - Keep Process
04/12/2025 13:58:43 - Keep Process
04/12/2025 14:02:39 - Keep Process
04/12/2025 14:26:41 - Remove Process
04/12/2025 14:27:59 - Remove Process
04/12/2025 14:33:37 - Remove Process
04/12/2025 14:47:35 - Keep Process
04/12/2025 14:50:33 - Keep Process
04/12/2025 14:52:54 - Keep Process
04/12/2025 15:15:57 - Keep Process
04/12/2025 15:26:30 - Keep Process
04/12/2025 15:31:37 - Keep Process
04/12/2025 15:34:45 - Keep Process
04/12/2025 15:44:03 - Remove Process
04/12/2025 15:49:44 - Remove Process
04/12/2025 15:51:52 - Remove Process
04/12/2025 15:57:22 - Keep Process
04/12/2025 16:02:59 - Remove Process
04/12/2025 16:07:07 - Remove Process
04/12/2025 16:44:57 - Remove Process
04/12/2025 16:49:48 - Remove Process
04/12/2025 16:50:56 - Remove Process
04/12/2025 17:15:29 - Remove Process
04/12/2025 17:16:22 - Keep Process
04/12/2025 17:22:46 - Keep Process
04/12/2025 17:26:27 - Remove Process
04/12/2025 17:37:59 - Keep Process
04/12/2025 17:41:46 - Remove Process
04/12/2025 17:57:05 - Remove Process
04/12/2025 18:05:23 - Keep Process
04/12/2025 18:09:06 - Remove Process
04/12/2025 18:33:34 - Remove Process
04/12/2025 18:34:16 - Keep Process
04/12/2025 18:34:54 - Keep Process
04/12/2025 18:43:03 - Remove Process
04/12/2025 19:00:57 - Remove Process
04/12/2025 19:04:38 - Remove Process
04/12/2025 19:11:00 - Keep Process
04/12/2025 20:19:23 - Remove Process
04/12/2025 20:55:41 - Remove Process
04/12/2025 21:26:13 - Keep Process
04/12/2025 21:33:09 - Keep Process
04/12/2025 21:48:20 - Keep Process
04/12/2025 22:04:03 - Keep Process
04/12/2025 22:11:29 - Keep Process
04/12/2025 22:12:51 - Keep Process
04/12/2025 22:14:40 - Keep Process
04/12/2025 22:32:26 - Keep Process
04/12/2025 22:40:32 - Remove Process
04/12/2025 22:40:34 - Remove Process
04/12/2025 22:41:04 - Remove Process
04/12/2025 22:48:59 - Keep Process
04/12/2025 22:51:41 - Keep Process
04/12/2025 23:17:54 - Keep Process
04/12/2025 23:30:42 - Keep Process
05/12/2025 02:20:29 - Keep Process
05/12/2025 06:30:57 - Remove Process
05/12/2025 06:52:33 - Keep Process
05/12/2025 07:02:58 - Remove Process
05/12/2025 07:32:24 - Keep Process
05/12/2025 08:25:45 - Keep Process
05/12/2025 08:26:51 - Remove Process
05/12/2025 09:20:43 - Remove Process
05/12/2025 09:55:18 - Remove Process
05/12/2025 10:02:34 - Remove Process
05/12/2025 10:33:28 - Keep Process
05/12/2025 10:49:42 - Remove Process
05/12/2025 11:03:04 - Keep Process
05/12/2025 11:29:00 - Remove Process
05/12/2025 11:48:56 - Remove Process
05/12/2025 11:56:19 - Remove Process
05/12/2025 12:06:16 - Remove Process
05/12/2025 12:39:23 - Remove Process
05/12/2025 12:41:33 - Keep Process
05/12/2025 12:49:35 - Keep Process
05/12/2025 12:51:04 - Remove Process
05/12/2025 13:06:53 - Keep Process
05/12/2025 13:09:12 - Keep Process
05/12/2025 13:23:19 - Remove Process
05/12/2025 13:24:41 - Keep Process
05/12/2025 13:40:37 - Remove Process
05/12/2025 13:40:49 - Remove Process
05/12/2025 13:46:37 - Remove Process
05/12/2025 13:48:20 - Remove Process
05/12/2025 13:48:43 - Remove Process
05/12/2025 13:57:43 - Remove Process
05/12/2025 14:02:21 - Remove Process
05/12/2025 14:05:24 - Remove Process
05/12/2025 14:47:55 - Keep Process
05/12/2025 14:55:47 - Keep Process
05/12/2025 14:58:32 - Remove Process
05/12/2025 14:59:50 - Keep Process
Rejected Submissions due to duplicate submissions from the same school where the most recent submission from the school only was kept and is listed above- as per the guidelines.
12/4/2025 10:35:11
12/4/2025 11:37:11
12/4/2025 12:14:25
12/4/2025 12:28:16
12/4/2025 13:48:10
12/4/2025 15:58:16
12/4/2025 17:16:20
12/4/2025 20:39:25
12/4/2025 22:42:11
12/5/2025 6:56:56
12/5/2025 14:56:54
Rejected Submissions due to wrong/inaccurate input of ID number, School PIN, or D.o.B leading to verification mismatch.
04/12/2025 11:49:05 - Remove Process
04/12/2025 16:01:42 - Keep Process
04/12/2025 16:59:18 - Keep Process
04/12/2025 20:25:24 - Remove Process
04/12/2025 20:37:05 - Remove Process
04/12/2025 21:03:23 - Remove Process
04/12/2025 21:58:00 - Remove Process
04/12/2025 23:31:40 - Remove Process
05/12/2025 09:45:06 - Remove Process
05/12/2025 11:33:53 - Keep Process
05/12/2025 11:51:36 - Remove Process
05/12/2025 11:53:55 - Keep Process
05/12/2025 13:26:25 - Remove Process
05/12/2025 14:15:21 - Keep Process
05/12/2025 14:42:45 - Remove Process
