Progress on more low level updates to the Events module loading process.
This commit is contained in:
@@ -5,6 +5,8 @@ import { db_save_ae_obj_li__ae_obj } from "$lib/ae_core/core__idb_dexie";
|
||||
import { db_events } from "$lib/ae_events/db_events";
|
||||
|
||||
import { load_ae_obj_li__event_device } from './ae_events__event_device';
|
||||
import { load_ae_obj_li__event_location } from './ae_events__event_location';
|
||||
import { load_ae_obj_li__event_session } from './ae_events__event_session';
|
||||
|
||||
let ae_promises: key_val = {};
|
||||
|
||||
@@ -96,23 +98,79 @@ export async function load_ae_obj_id__event(
|
||||
}
|
||||
|
||||
if (inc_device_li) {
|
||||
// Load the devices for the
|
||||
// Load the devices for the event
|
||||
if (log_lvl) {
|
||||
console.log(`Need to load the device list for the now`);
|
||||
console.log(`Need to load the device list for the event now`);
|
||||
}
|
||||
let load_event_device_obj_li = load_ae_obj_li__event_device({
|
||||
api_cfg: api_cfg,
|
||||
for_obj_type: 'event',
|
||||
for_obj_id: event_id,
|
||||
params: {qry__enabled: 'all', qry__limit: 50},
|
||||
params: {qry__enabled: 'enabled', qry__limit: 49},
|
||||
try_cache: try_cache,
|
||||
log_lvl: log_lvl
|
||||
}).then((event_device_obj_li) => {
|
||||
if (log_lvl) {
|
||||
console.log(`event_device_obj_li = `, event_device_obj_li);
|
||||
}
|
||||
return event_device_obj_li;
|
||||
});
|
||||
|
||||
|
||||
if (log_lvl) {
|
||||
console.log(`load_event_device_obj_li = `, load_event_device_obj_li);
|
||||
}
|
||||
ae_promises.load__event_obj.event_device_li = load_event_device_obj_li;
|
||||
ae_promises.load__event_obj.event_device_obj_li = load_event_device_obj_li;
|
||||
}
|
||||
|
||||
if (inc_location_li) {
|
||||
// Load the locations for the event
|
||||
if (log_lvl) {
|
||||
console.log(`Need to load the location list for the event now`);
|
||||
}
|
||||
let load_event_location_obj_li = load_ae_obj_li__event_location({
|
||||
api_cfg: api_cfg,
|
||||
for_obj_type: 'event',
|
||||
for_obj_id: event_id,
|
||||
params: {qry__enabled: 'enabled', qry__limit: 19},
|
||||
try_cache: try_cache,
|
||||
log_lvl: log_lvl
|
||||
}).then((event_location_obj_li) => {
|
||||
if (log_lvl) {
|
||||
console.log(`event_location_obj_li = `, event_location_obj_li);
|
||||
}
|
||||
return event_location_obj_li;
|
||||
});
|
||||
|
||||
if (log_lvl) {
|
||||
console.log(`load_event_location_obj_li = `, load_event_location_obj_li);
|
||||
}
|
||||
ae_promises.load__event_obj.event_location_obj_li = load_event_location_obj_li;
|
||||
}
|
||||
|
||||
if (inc_session_li) {
|
||||
// Load the sessions for the events
|
||||
if (log_lvl) {
|
||||
console.log(`Need to load the session list for the event now`);
|
||||
}
|
||||
let load_event_session_obj_li = load_ae_obj_li__event_session({
|
||||
api_cfg: api_cfg,
|
||||
for_obj_type: 'event',
|
||||
for_obj_id: event_id,
|
||||
params: {qry__enabled: 'enabled', qry__limit: 249},
|
||||
try_cache: try_cache,
|
||||
log_lvl: log_lvl
|
||||
}).then((event_session_obj_li) => {
|
||||
if (log_lvl) {
|
||||
console.log(`event_session_obj_li = `, event_session_obj_li);
|
||||
}
|
||||
return event_session_obj_li;
|
||||
});
|
||||
|
||||
if (log_lvl) {
|
||||
console.log(`load_event_session_obj_li = `, load_event_session_obj_li);
|
||||
}
|
||||
ae_promises.load__event_obj.event_session_obj_li = load_event_session_obj_li;
|
||||
}
|
||||
|
||||
return ae_promises.load__event_obj;
|
||||
@@ -127,6 +185,7 @@ export async function load_ae_obj_li__event(
|
||||
for_obj_id,
|
||||
qry_conference = true,
|
||||
qry_str = null,
|
||||
inc_device_li = false,
|
||||
inc_file_li = false,
|
||||
inc_location_li = false,
|
||||
inc_presentation_li = false,
|
||||
@@ -147,6 +206,7 @@ export async function load_ae_obj_li__event(
|
||||
for_obj_id: string,
|
||||
qry_conference?: null|boolean,
|
||||
qry_str?: null|string,
|
||||
inc_device_li?: boolean,
|
||||
inc_file_li?: boolean,
|
||||
inc_location_li?: boolean,
|
||||
inc_presentation_li?: boolean,
|
||||
@@ -233,7 +293,7 @@ export async function load_ae_obj_li__event(
|
||||
if (log_lvl) {
|
||||
console.log('Saving to DB...');
|
||||
}
|
||||
db_save_ae_obj_li__ae_obj({
|
||||
await db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_events,
|
||||
table_name: 'events',
|
||||
obj_li: processed_obj_li,
|
||||
@@ -257,6 +317,117 @@ export async function load_ae_obj_li__event(
|
||||
if (log_lvl) {
|
||||
console.log('ae_promises.load__event_obj_li:', ae_promises.load__event_obj_li);
|
||||
}
|
||||
|
||||
if (inc_device_li) {
|
||||
// Load the devices for the events
|
||||
if (log_lvl) {
|
||||
console.log(`Need to load the device list for each event now`);
|
||||
}
|
||||
for (let i = 0; i < ae_promises.load__event_obj_li.length; i++) {
|
||||
let event_obj = ae_promises.load__event_obj_li[i];
|
||||
let event_id = event_obj.event_id_random;
|
||||
|
||||
let load_event_device_obj_li = load_ae_obj_li__event_device({
|
||||
api_cfg: api_cfg,
|
||||
for_obj_type: 'event',
|
||||
for_obj_id: event_id,
|
||||
params: {qry__enabled: 'enabled', qry__limit: 49},
|
||||
try_cache: try_cache,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then((event_device_obj_li) => {
|
||||
if (log_lvl) {
|
||||
console.log(`event_device_obj_li = `, event_device_obj_li);
|
||||
}
|
||||
|
||||
return event_device_obj_li;
|
||||
});
|
||||
|
||||
if (log_lvl) {
|
||||
console.log(`load_event_device_obj_li = `, load_event_device_obj_li);
|
||||
}
|
||||
|
||||
if (load_event_device_obj_li) {
|
||||
ae_promises.load__event_obj_li[i].event_device_obj_li = load_event_device_obj_li;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (inc_location_li) {
|
||||
// Load the locations for the events
|
||||
if (log_lvl) {
|
||||
console.log(`Need to load the location list for each event now`);
|
||||
}
|
||||
for (let i = 0; i < ae_promises.load__event_obj_li.length; i++) {
|
||||
let event_obj = ae_promises.load__event_obj_li[i];
|
||||
let event_id = event_obj.event_id_random;
|
||||
|
||||
let load_event_location_obj_li = load_ae_obj_li__event_location({
|
||||
api_cfg: api_cfg,
|
||||
for_obj_type: 'event',
|
||||
for_obj_id: event_id,
|
||||
params: {qry__enabled: 'enabled', qry__limit: 19},
|
||||
try_cache: try_cache,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then((event_location_obj_li) => {
|
||||
if (log_lvl) {
|
||||
console.log(`event_location_obj_li = `, event_location_obj_li);
|
||||
}
|
||||
|
||||
return event_location_obj_li;
|
||||
});
|
||||
|
||||
if (log_lvl) {
|
||||
console.log(`load_event_location_obj_li = `, load_event_location_obj_li);
|
||||
}
|
||||
|
||||
if (load_event_location_obj_li) {
|
||||
ae_promises.load__event_obj_li[i].event_location_obj_li = load_event_location_obj_li;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (inc_session_li) {
|
||||
// Load the sessions for the events
|
||||
if (log_lvl) {
|
||||
console.log(`Need to load the session list for each event now`);
|
||||
}
|
||||
for (let i = 0; i < ae_promises.load__event_obj_li.length; i++) {
|
||||
let event_obj = ae_promises.load__event_obj_li[i];
|
||||
let event_id = event_obj.event_id_random;
|
||||
|
||||
let load_event_session_obj_li = load_ae_obj_li__event_session({
|
||||
api_cfg: api_cfg,
|
||||
for_obj_type: 'event',
|
||||
for_obj_id: event_id,
|
||||
enabled: enabled,
|
||||
hidden: hidden,
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
order_by_li: order_by_li,
|
||||
params: params,
|
||||
try_cache: try_cache,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then((event_session_obj_li) => {
|
||||
if (log_lvl) {
|
||||
console.log(`event_session_obj_li = `, event_session_obj_li);
|
||||
}
|
||||
|
||||
return event_session_obj_li;
|
||||
});
|
||||
|
||||
if (log_lvl) {
|
||||
console.log(`load_event_session_obj_li = `, load_event_session_obj_li);
|
||||
}
|
||||
|
||||
if (load_event_session_obj_li) {
|
||||
ae_promises.load__event_obj_li[i].event_session_obj_li = load_event_session_obj_li;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ae_promises.load__event_obj_li;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user