if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', function() { get_existing_data(); console.log("moderator assignments loading..."); }); } else { get_existing_data(); console.log("moderator assignments, DOM not loaded"); } var results = []; var all_times = []; var page_data = []; var room_color = ""; function room_color(color) { switch (color) { case "Green": room_color = "#ff4d4d"; break; case "Red": room_color = "#FF7B78"; break; case "Orange": room_color = "#f38b00"; break; default: room_color = "grey"; } return room_color; } function set_up_mod_objects(sheet_rows) { var data = [sheet_rows]; for (var i = 0; i < data.length; i++) { for (var j = 0; j < data[i].length; j++) { results.push(data[i][j]["c"]); } } results.sort(); // set up moderator objects with zoom info and empty array for participants results.forEach(function(current_value) { var x = { moderator: current_value[0]["v"], time: current_value[5]["v"], room: current_value[7]["v"], link: current_value[8]["v"], id: current_value[9]["v"], participants: [] }; all_times.push(x); }); all_times.sort(); //get unique moderators with object keys page_data = all_times.filter((v, i, a) => a.findIndex(t => (t.moderator === v.moderator && t.time === v.time)) === i); console.log("page data ", page_data); // get participant data, add to page_data array results.forEach(function(current_value) { for (var i = 0; i < page_data.length; i++) { if (page_data[i].moderator === current_value[0]["v"]) { page_data[i].participants.push({ p_fname: current_value[1]["v"], p_lname: current_value[2]["v"], p_id: current_value[3]["v"], p_email: current_value[4]["v"], p_course: current_value[10]["v"] }); } } }); // send page data to create tabs function create_tabs(page_data); } function get_existing_data() { var sheet_rows = []; $.get("https://docs.google.com/spreadsheets/d/1hivjC4FTSyRS1wq4-Jz0KEsz949PiZybAyThze7fMcA/gviz/tq?tqx=out:json", function(data) { const json = JSON.parse(data.substr(47).slice(0, -2)); sheet_rows = json.table.rows; sheet_rows.shift(); set_up_mod_objects(sheet_rows); }); } function create_tabs(moderator_list) { $(".mlist").remove(); $(".plist").remove(); moderator_list.forEach(function(i, index) { switch (i.room) { case "Green": room_color = "#009933"; break; case "Red": room_color = "#FF7B78"; break; case "Orange": room_color = "#f38b00"; break; default: room_color = "grey"; // } // add moderator names to small tabs at top of page $(".moderator-list").append($( '
' + i.moderator + '' +
'' +
'' +
'
' + i.time + '
' + i.room + ' Room: ' + i.link + '
Phone: +1 669 900 6833 | Meeting ID:' + i.id + '
Passcode: gci2023
Host key: 967543
First Name | Last Name | Profile |
---|