More general code clean up. Improvement to IDB save for Event.

This commit is contained in:
Scott Idem
2025-05-09 14:13:59 -04:00
parent 8f1f7bfa7e
commit dc7da8c930
6 changed files with 34 additions and 18 deletions

View File

@@ -160,7 +160,9 @@ export async function load_ae_obj_li__event(
params_json['and_qry'] = {};
}
console.log('qry_conference is false!');
if (log_lvl) {
console.log('qry_conference is false!');
}
params_json['and_qry']['conference'] = qry_conference;
}
@@ -504,7 +506,8 @@ export async function update_ae_obj__event(
// This function will loop through the event_obj_li and save each one to the DB.
export function db_save_ae_obj_li__event(
// Updated 2025-05-09
export async function db_save_ae_obj_li__event(
{
obj_type,
obj_li,
@@ -520,7 +523,9 @@ export function db_save_ae_obj_li__event(
}
if (obj_li && obj_li.length) {
obj_li.forEach(async function (obj: any) {
// let obj_li_id: string[] = [];
for (const obj of obj_li) {
// obj_li.forEach(async function (obj: any) {
if (log_lvl) {
console.log(`ae_obj ${obj_type}:`, obj);
}
@@ -610,6 +615,8 @@ export function db_save_ae_obj_li__event(
event_file_id_li_json: obj.event_file_id_li_json,
});
// console.log(`Put obj with ID: ${obj.event_id_random} or ${id_random}`);
// obj_li_id.push(obj_record.id);
} catch (error) {
let status = `Failed to put ${obj.event_id_random}: ${error}`;
console.log(status);
@@ -617,7 +624,7 @@ export function db_save_ae_obj_li__event(
// const id_random = await db_events.events.put(obj);
// console.log(`Put obj with ID: ${obj.event_id_random}`);
});
}
return true;
}