Still working on listing the presentations
This commit is contained in:
@@ -49,10 +49,10 @@ exports.render_event_file_records = function (event_files, event_id) {
|
||||
}
|
||||
|
||||
|
||||
exports.render_event_location_records = function () {
|
||||
exports.render_event_location_records = async function () {
|
||||
console.log('Rendering event location records...');
|
||||
|
||||
tbl_event_location.iterate(function(value, key, iteration) {
|
||||
await tbl_event_location.iterate(function(value, key, iteration) {
|
||||
if (value.id == event_location_id) {
|
||||
console.log('*** Event location id ('+event_location_id+') found in table.');
|
||||
document.getElementById('location_name').innerHTML = '<span class="fas fa-map-marker"></span> '+value.name;
|
||||
@@ -72,7 +72,7 @@ exports.render_event_location_file_records = function (events) {
|
||||
}
|
||||
|
||||
|
||||
exports.render_event_session_records = function () {
|
||||
exports.render_event_session_records = async function () {
|
||||
console.log('Rendering event session records...');
|
||||
|
||||
// First: update or add sessions
|
||||
@@ -245,32 +245,79 @@ exports.render_event_session_file_records = function (events) {
|
||||
}
|
||||
|
||||
|
||||
exports.render_event_presentation_records = function (events) {
|
||||
exports.render_event_presentation_records = async function (events) {
|
||||
console.log('********** ********* ****** ** * ** ****** ********* *********');
|
||||
console.log('Rendering event presentation records...');
|
||||
|
||||
let launcher_sessions = document.getElementById('launcher_sessions').childNodes; //_list_items
|
||||
console.log(launcher_sessions);
|
||||
console.log(tbl_event_presentation);
|
||||
|
||||
for (var i in launcher_sessions) {
|
||||
/*
|
||||
loop through the sessions list (not table) {
|
||||
let session_id = ;
|
||||
attempt to loop through list of presentations (possibly empty) {
|
||||
let presentation_id = ;
|
||||
let presentation_id_found = false;
|
||||
iterate through tbl_event_presentation
|
||||
if (li presentation_id = tbl_event_presentation.id and session id = tbl_event_presentation.event_session_id) {
|
||||
update the presentation_id
|
||||
presentation_id_found = true;
|
||||
} else if (session id = tbl_event_presentation.event_session_id) {
|
||||
add in the new presentation_id from the table
|
||||
presentation_id_found = true;
|
||||
}
|
||||
if (presentation_id_found == false) {
|
||||
// remove the presentation
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
for (let i in launcher_sessions) {
|
||||
console.log(launcher_sessions[i].getAttribute('data-session_id'));
|
||||
let session_id = launcher_sessions[i].getAttribute('data-session_id');
|
||||
|
||||
console.log(launcher_sessions[i].getElementsByClassName('session_presentations')[0].getElementsByTagName('ul').childElementCount);
|
||||
let new_i = i;
|
||||
if (launcher_sessions[new_i].getElementsByClassName('session_presentations')[0].getElementsByTagName('ul').childElementCount) {
|
||||
console.log('Presentations listed under this session');
|
||||
//console.log(launcher_sessions[i].getElementsByClassName('session_presentations')[0].getElementsByTagName('ul').childElementCount);
|
||||
|
||||
let presentations_list = launcher_sessions[i].getElementsByClassName('session_presentations')[0].getElementsByTagName('ul')[0].childNodes;
|
||||
console.log(presentations_list);
|
||||
//console.log(presentations_list.length);
|
||||
if (presentations_list.length) {
|
||||
console.log('Presentations listed under this session (id='+session_id+'). (launcher sessions loop i = '+i+')');
|
||||
console.log(launcher_sessions[i].getElementsByClassName('session_presentations')[0].getElementsByTagName('ul'));
|
||||
} else {
|
||||
console.log('No presentations listed under this session. Time to iterate through presentations table.');
|
||||
/*
|
||||
* loop through list of presentations
|
||||
* if in
|
||||
*/
|
||||
await tbl_event_presentation.iterate(function(value, key, iteration) {
|
||||
if (document.getElementById('event_presentation_'+value.id)) {
|
||||
// Update the launcher presentations list for a session
|
||||
document.getElementById('event_presentation_'+value.id).getElementsByTagName('div')[0].getElementsByTagName('strong')[0].innerHTML = value.name;
|
||||
let presentation_startdatetime = new Date(value.start_datetime);
|
||||
document.getElementById('event_presentation_'+value.id).getElementsByTagName('div')[0].getElementsByTagName('span')[0].innerHTML = dateFns.format(presentation_startdatetime, 'h:mm A');
|
||||
} else {
|
||||
|
||||
}
|
||||
}).then(function() {
|
||||
|
||||
});
|
||||
|
||||
} else {
|
||||
console.log('No presentations listed under this session (id='+session_id+'). Time to iterate through presentations table. (launcher sessions loop i = '+i+')');
|
||||
|
||||
let new_i = i;
|
||||
console.log(new_i);
|
||||
|
||||
|
||||
tbl_event_presentation.iterate(function(value, key, iteration) {
|
||||
console.log('here 1??? '+new_i);
|
||||
//if (!looping_tbl_event_presentation) {
|
||||
// looping_tbl_event_presentation = true;
|
||||
await tbl_event_presentation.iterate(function(value, key, iteration) {
|
||||
console.log('Launcher sessions loop i: '+i+' : '+new_i);
|
||||
if (value.event_session_id == session_id) {
|
||||
console.log('*** Presentation id ('+value.id+') is part of this session.');
|
||||
console.log('*** Presentation id ('+value.id+') is part of this session ('+session_id+'). (launcher sessions loop i='+i+')');
|
||||
|
||||
// Add the new session to the launcher sessions list
|
||||
let presentation_li_node = document.createElement('LI');
|
||||
@@ -299,14 +346,18 @@ exports.render_event_presentation_records = function (events) {
|
||||
presentation_li_node.appendChild(presentation_li_heading_div_node);
|
||||
|
||||
console.log('************ ISSUE ************');
|
||||
console.log('here 2??? '+new_i);
|
||||
console.log(launcher_sessions[new_i].getElementsByClassName('session_presentations'));
|
||||
launcher_sessions[new_i].getElementsByClassName('session_presentations')[0].getElementsByTagName('ul')[0].appendChild(presentation_li_node);
|
||||
console.log(launcher_sessions[i].getElementsByClassName('session_presentations'));
|
||||
//launcher_sessions[i].getElementsByClassName('session_presentations')[0].getElementsByTagName('ul')[0].appendChild(presentation_li_node);
|
||||
let launcher_session_details = document.getElementById('detail_session_'+session_id);
|
||||
console.log(launcher_session_details.getElementsByClassName('session_presentations'));
|
||||
let session = document.getElementById('detail_session_'+session_id).getElementsByClassName('session_presentations')[0].getElementsByTagName('ul')[0].appendChild(presentation_li_node);
|
||||
} else {
|
||||
console.log('*** Presentation id ('+value.id+') is NOT part of this session.');
|
||||
console.log('*** Presentation id ('+value.id+') is NOT part of this session ('+session_id+'). (launcher sessions loop i='+i+')');
|
||||
}
|
||||
}).then(function() {
|
||||
console.log('idb_to_ui: Iterate tbl_event_presentation looking for presentations to update or add is complete')
|
||||
console.log('idb_to_ui: Iterate tbl_event_presentation looking for presentations to update or add is complete');
|
||||
looping_tbl_event_presentation = true;
|
||||
//tbl_event_presentation_iterate_count++;
|
||||
/*
|
||||
if (session_valid) {
|
||||
console.log('Keep session id '+session_id);
|
||||
@@ -317,6 +368,10 @@ exports.render_event_presentation_records = function (events) {
|
||||
}
|
||||
*/
|
||||
});
|
||||
|
||||
//} else {
|
||||
// console.log('Waiting until tbl_event_presentation has finished iterating...');
|
||||
//}
|
||||
|
||||
|
||||
/*
|
||||
@@ -331,18 +386,13 @@ exports.render_event_presentation_records = function (events) {
|
||||
|
||||
}
|
||||
|
||||
//} else {
|
||||
// console.log('Waiting until launcher_sessions has finished looping...');
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
//.getElementsByTagName('ul')[0].childNodes;
|
||||
|
||||
/*
|
||||
|
||||
Loop through session divs
|
||||
Look for presentations to update in each session. Update
|
||||
Look for presentations to add in each session. Append presentations into the div
|
||||
Look for presentations to remove from each session. Remove
|
||||
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user