Mostly working. Need to finish up loading event files and then updating and deleting them.

This commit is contained in:
Scott Idem
2020-02-12 23:40:34 -05:00
parent 2d87ccfa73
commit 9a325c7543
3 changed files with 199 additions and 118 deletions

View File

@@ -42,8 +42,14 @@
<div class="row no-gutters">
<div id="launcher_menu" class="launcher_menu col-3 border-right">
<div id="event_files_menu" class="event_files_menu"></div>
<div id="location_files_menu" class="location_files_menu"></div>
<div id="event_files_menu" class="event_files_menu d-none">
<h2>Event Files</h2>
<ul class="list-group list-group-flush event_files_list" role=""></ul>
</div>
<div id="location_files_menu" class="location_files_menu d-none">
<h2>Location Files</h2>
<ul class="list-group list-group-flush location_files_list event_files_list" role=""></ul>
</div>
<div id="sessions_menu" class="sessions_menu d-none">
<h2>Sessions</h2>
<ul class="list-group list-group-flush" role=""></ul>
@@ -266,9 +272,12 @@
let safe_to_render_launcher = false; // currently only set to true in module_app_idb.js
let run_check_file_cache = false;
let looping_tbl_event = false;
let looping_tbl_event_location = false;
let looping_tbl_event_session = false;
let looping_tbl_event_presentation = false;
let looping_tbl_event_presenter = false;
let looping_tbl_event_file = false;
//const loading_loop_interval = app_config.loading_loop_interval; // in milliseconds
@@ -432,6 +441,8 @@
safe_to_render_launcher = false; // Set to false so that the launcher render only starts after the launcher object has updated
run_check_file_cache = true; // Set to true so that the local file cache will be checked against the updated event files
idb_event_file_check_datetime = Date.now() + idb_event_file_check_period;
let render_event_file_records_result = await uiv2.render_event_file_records(); // NOTE: v2 idb to ui
}
@@ -446,89 +457,10 @@
var idb_to_launcher_loop = setInterval(function() {
if (run_idb_to_launcher) {
console.log('FLAG: run_idb_to_launcher='+run_idb_to_launcher);
if (tbl_event_key_count != null && tbl_event_location_key_count != null && tbl_event_session_key_count != null
&& tbl_event_presentation_key_count != null && tbl_event_presenter_key_count != null
&& tbl_event_file_key_count != null) {
console.log('All IDB tables have records. Going to create/update the launcher object now...');
idb_tables_have_records = true;
run_idb_to_launcher = false;
if (!idb_to_launcher_in_progress) {
console.log('idb_to_launcher is NOT in progress');
let idb_to_launcher_result = idb.idb_to_launcher().then(function(response) {
console.log('idb_to_launcher is complete... I think?');
//console.log('*** idb_to_launcher response: *** Launcher object has now been created/updated with IDB data.');
//console.log(response);
//clearInterval(idb_to_launcher_loop);
//launcher = response;
//safe_to_render_launcher = true;
run_render_launcher = true;
});
idb_to_launcher_in_progress = true;
} else {
console.log('idb_to_launcher IS in progress');
}
//console.log('*** idb_to_launcher_result: ***');
//console.log(idb_to_launcher_result);
} else {
console.log('Not all IDB tables have records. Setting flag to true update IDB database.');
idb_tables_have_records = false;
safe_to_render_launcher = false;
run_update_idb = true;
}
} else {
//console.log('run_idb_to_launcher is set to false');
}
}, idb_to_launcher_loop_interval);
var update_render_loop = setInterval(async function() {
//if (run_render_launcher) {
// console.log('Flag to run idb_to_launcher is set to true');
current_plus10_datetime = Date.now() + 10000; // add 10 seconds
let enough_time_to_render = false;
if (
current_plus10_datetime < idb_event_check_datetime
&& current_plus10_datetime < idb_event_location_check_datetime
&& current_plus10_datetime < idb_event_session_check_datetime
&& current_plus10_datetime < idb_event_presentation_check_datetime
&& current_plus10_datetime < idb_event_presenter_check_datetime
&& current_plus10_datetime < idb_event_file_check_datetime
) {
console.log('SETTING FLAG: enough_time_to_render=true');
enough_time_to_render = true;
} else {
//console.log(current_plus10_datetime);
//console.log(idb_event_check_datetime);
//console.log(idb_event_location_check_datetime);
//console.log(idb_event_session_check_datetime);
//console.log(idb_event_presentation_check_datetime);
//console.log(idb_event_presenter_check_datetime);
//console.log(idb_event_file_check_datetime);
enough_time_to_render = false;
}
console.log('FLAG: safe_to_render_launcher='+safe_to_render_launcher);
console.log('FLAG: enough_time_to_render='+enough_time_to_render);
if (safe_to_render_launcher && enough_time_to_render) {
//////////////let render_launcher_result = ui.render_launcher(launcher);
run_render_launcher = false; // Set to true so that the launcher will be rendered again
safe_to_render_launcher = false;
} else {
}
//} else {
// console.log('Flag to run idb_to_launcher is set to false');
//}
}, update_render_loop_interval);