Working on making the rendering more efficient...

This commit is contained in:
Scott Idem
2020-01-29 17:58:35 -05:00
parent 7e79f333c2
commit 5bd557e743
3 changed files with 232 additions and 117 deletions

View File

@@ -13,43 +13,64 @@ exports.create_load_idb = async function create_load_idb() {
exports.idb_to_launcher = async function idb_to_launcher() {
//tbl_example.iterate(tbl_check, tbl_check_success, tbl_check_error); //tbl_check(value, key, iteration)
//let launcher = new Object();
let launcher_new = new Object();
let tbl_event_complete = false;
let tbl_event_file_complete = false;
let tbl_event_location_complete = false;
let tbl_event_location_file_complete = false;
let tbl_event_session_complete = false;
let tbl_event_session_file_complete = false;
let tbl_event_presentation_complete = false;
let tbl_event_presentation_file_complete = false;
let tbl_event_presenter_complete = false;
let tbl_event_presenter_file_complete = false;
// Look for *events*
let tmp_event = [];
tbl_event.iterate(function(event_value, key, iteration) {
tmp_event.push(event_value);
}).then(function() {
console.log('idb_to_launcher: Iterate tbl_event complete')
tbl_event_complete = true;
});
launcher.event = tmp_event;
launcher_new.event = tmp_event;
// Look for *event files*
let tmp_event_file = []
tbl_event_file.iterate(function(file_value, key, iteration) {
//console.log('event id: '+launcher.event[0].id+' -> file_id: '+file_value.id+'for type: '+file_value.for_type+' for id: '+file_value.id);
if (file_value.for_type == 'event' && launcher.event[0].id == file_value.for_id) {
//console.log('event id: '+launcher_new.event[0].id+' -> file_id: '+file_value.id+'for type: '+file_value.for_type+' for id: '+file_value.id);
if (file_value.for_type == 'event' && launcher_new.event[0].id == file_value.for_id) {
tmp_event_file.push(file_value);
}
}).then(function() {
console.log('idb_to_launcher: Iterate tbl_event_file complete')
tbl_event_file_complete = true;
});
launcher.event_file = tmp_event_file;
launcher_new.event_file = tmp_event_file;
// Look for *locations*
let tmp_event_location = []
tbl_event_location.iterate(function(location_value, key, iteration) {
tmp_event_location.push(location_value);
}).then(function() {
console.log('idb_to_launcher: Iterate tbl_event_location complete')
tbl_event_location_complete = true;
});
launcher.location = tmp_event_location;
launcher_new.location = tmp_event_location;
// Look for *event location files*
let tmp_event_location_file = []
tbl_event_file.iterate(function(file_value, key, iteration) {
if (file_value.for_type == 'location' && launcher.location[0].id == file_value.for_id) {
if (file_value.for_type == 'location' && launcher_new.location[0].id == file_value.for_id) {
tmp_event_location_file.push(file_value);
}
}).then(function() {
console.log('idb_to_launcher: Iterate tbl_event_file complete')
tbl_event_location_file_complete = true;
});
launcher.location_file = tmp_event_location_file;
launcher_new.location_file = tmp_event_location_file;
// Look for *sessions*
@@ -66,6 +87,9 @@ exports.idb_to_launcher = async function idb_to_launcher() {
session_value.file.push(session_file_value)
//tmp_event_session_file.push(session_file_value);
}
}).then(function() {
console.log('idb_to_launcher: Iterate tbl_event_file complete')
tbl_event_session_file_complete = true;
});
@@ -82,6 +106,9 @@ exports.idb_to_launcher = async function idb_to_launcher() {
if (presentation_file_value.for_type == 'presentation' && presentation_value.id == presentation_file_value.for_id) {
presentation_value.file.push(presentation_file_value);
}
}).then(function() {
console.log('idb_to_launcher: Iterate tbl_event_file complete')
tbl_event_presentation_file_complete = true;
});
@@ -97,26 +124,23 @@ exports.idb_to_launcher = async function idb_to_launcher() {
if (presenter_file_value.for_type == 'presenter' && presenter_value.id == presenter_file_value.for_id) {
presenter_value.file.push(presenter_file_value);
}
}).then(function() {
console.log('idb_to_launcher: Iterate tbl_event_file complete')
tbl_event_presenter_file_complete = true;
});
//NOTE for some reason this is adding duplicate presenters to a session
//NOTE is this iterating twice or something???
/*
tbl_event_file.iterate(function(presenter_file_value, key, iteration) {
});
*/
presentation_value.presenter.push(presenter_value);
}
}).then(function() {
console.log('idb_to_launcher: Iterate tbl_event_presenter complete')
tbl_event_presenter_complete = true;
});
//NOTE add in presenters and then presenter's files
session_value.presentation.push(presentation_value);
}//);
}).then(function() {
console.log('idb_to_launcher: Iterate tbl_event_presentation complete')
tbl_event_presentation_complete = true;
});
//});
@@ -124,8 +148,9 @@ exports.idb_to_launcher = async function idb_to_launcher() {
}).then(function() {
console.log('idb_to_launcher: Iterate tbl_event_session complete')
tbl_event_session_complete = true;
});
launcher.session = tmp_event_session;
launcher_new.session = tmp_event_session;
/*
console.log('v2 idb to launcher object: ***');
@@ -133,7 +158,20 @@ exports.idb_to_launcher = async function idb_to_launcher() {
console.log('v2 idb to launcher object: ^^^');
*/
return true;
var creating_launcher_object_loop = setInterval(function() {
if (tbl_event_complete && tbl_event_file_complete && tbl_event_location_complete && tbl_event_location_file_complete && tbl_event_session_complete && tbl_event_session_file_complete && tbl_event_presentation_complete && tbl_event_presentation_file_complete && tbl_event_presenter_complete && tbl_event_presenter_file_complete) {
console.log('And DONE!!!');
console.log('v2 idb to launcher object: ***');
console.log(launcher_new);
console.log('v2 idb to launcher object: ^^^');
ui.render_launcher(launcher_new);
clearInterval(creating_launcher_object_loop);
return launcher_new;
} else {
console.log('Still building...');
}
}, 5);
//return launcher_new;
}
exports.check_file_cache = async function () {