diff --git a/src/routes/idaa/(idaa)/recovery_meetings/+page.svelte b/src/routes/idaa/(idaa)/recovery_meetings/+page.svelte index 13a6e196..b121c490 100644 --- a/src/routes/idaa/(idaa)/recovery_meetings/+page.svelte +++ b/src/routes/idaa/(idaa)/recovery_meetings/+page.svelte @@ -9,14 +9,14 @@ import { browser } from '$app/environment'; import { Modal } from 'flowbite-svelte'; -import type { key_val } from '$lib/ae_stores'; +// import type { key_val } from '$lib/ae_stores'; import { ae_util } from '$lib/ae_utils/ae_utils'; import { idaa_loc, idaa_sess, idaa_slct, idaa_trig, idaa_prom } from '$lib/ae_idaa_stores'; // import Element_data_store from '$lib/element_data_store_v2.svelte'; // import Comp_event_session_obj_li from '../../events_pres_mgmt/ae_comp__event_session_obj_li.svelte'; import { liveQuery } from "dexie"; -import { core_func } from '$lib/ae_core/ae_core_functions'; +// import { core_func } from '$lib/ae_core/ae_core_functions'; import { db_events } from "$lib/ae_events/db_events"; import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores'; import { events_func } from '$lib/ae_events_functions'; @@ -79,6 +79,8 @@ $: lq_new__event_obj_li = liveQuery(async () => { }); +// This (event_li trigger for IDAA) is not currently being used. +// Updated 2024-11-19 $: if ($idaa_trig.event_li) { $idaa_trig.event_li = false; @@ -108,6 +110,7 @@ $: if ($idaa_trig.event_li) { } +// Updated 2024-11-19 $: if ($idaa_trig.event_li_qry) { $idaa_trig.event_li_qry = false; diff --git a/src/routes/idaa/(idaa)/recovery_meetings/ae_idaa_comp__event_obj_qry.svelte b/src/routes/idaa/(idaa)/recovery_meetings/ae_idaa_comp__event_obj_qry.svelte index 70f91cdb..fdf1ddef 100644 --- a/src/routes/idaa/(idaa)/recovery_meetings/ae_idaa_comp__event_obj_qry.svelte +++ b/src/routes/idaa/(idaa)/recovery_meetings/ae_idaa_comp__event_obj_qry.svelte @@ -8,7 +8,7 @@ import { ae_util } from '$lib/ae_utils/ae_utils'; import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores'; import { core_func } from '$lib/ae_core/ae_core_functions'; import { idaa_loc, idaa_sess, idaa_slct, idaa_trig, idaa_prom } from '$lib/ae_idaa_stores'; -import { events_func } from '$lib/ae_events_functions'; +// import { events_func } from '$lib/ae_events_functions'; export let log_lvl = 0; export let event_id_random_li: Array; @@ -16,11 +16,11 @@ export let event_id_random_li: Array; // export let container_class_li = []; let ae_promises: key_val = {}; -let ae_tmp: key_val = {}; -let ae_trigger: any = null; -let ae_triggers: key_val = {}; +// let ae_tmp: key_val = {}; +// let ae_trigger: any = null; +// let ae_triggers: key_val = {}; -let search_submit_results: any = null; +// let search_submit_results: any = null; onMount(() => { console.log('** AE IDAA Mounted: ** Query - Recovery Meeting (Event) Obj'); @@ -32,157 +32,158 @@ if ($idaa_loc.recovery_meetings.qry__fulltext_str && $idaa_loc.recovery_meetings // Updated 2024-10-01 -$: if (ae_trigger == 'load__event_obj_li') { - if (log_lvl) { - console.log('*** TEST SEARCH - load__event_obj_li == load__event_obj_li ***'); - } - ae_trigger = null; - if ($idaa_sess.recovery_meetings.qry_status == 'loading') { - console.log('*** $idaa_sess.recovery_meetings.qry_status == loading ***'); +// $: if (ae_trigger == 'load__event_obj_li') { +// if (log_lvl) { +// console.log('*** TEST SEARCH - load__event_obj_li == load__event_obj_li ***'); +// } +// ae_trigger = null; +// $idaa_trig.event_li_qry = true; +// if ($idaa_sess.recovery_meetings.qry_status == 'loading') { +// console.log('*** $idaa_sess.recovery_meetings.qry_status == loading ***'); - setTimeout(() => { - console.log("Delayed for X second."); - // ae_trigger = null; - // handle_qry__event({ft_qry_str: $idaa_loc.recovery_meetings.qry__fulltext_str}); - $idaa_trig.event_li_qry = true; - }, 250); - } else { - console.log('*** $idaa_sess.recovery_meetings.qry_status != loading ***'); - // ae_trigger = null; - // handle_qry__event({ft_qry_str: $idaa_loc.recovery_meetings.qry__fulltext_str}); - $idaa_trig.event_li_qry = true; - } -} +// setTimeout(() => { +// console.log("Delayed for X second."); +// // ae_trigger = null; +// // handle_qry__event({ft_qry_str: $idaa_loc.recovery_meetings.qry__fulltext_str}); +// $idaa_trig.event_li_qry = true; +// }, 250); +// } else { +// console.log('*** $idaa_sess.recovery_meetings.qry_status != loading ***'); +// // ae_trigger = null; +// // handle_qry__event({ft_qry_str: $idaa_loc.recovery_meetings.qry__fulltext_str}); +// $idaa_trig.event_li_qry = true; +// } +// } -async function handle_qry__event( - { - ft_qry_str = '', - and_physical = $idaa_loc.recovery_meetings.qry__physical, - and_virtual = $idaa_loc.recovery_meetings.qry__virtual, - and_type = $idaa_loc.recovery_meetings.qry__type, - order_by_li = $idaa_loc.recovery_meetings.qry__order_by_li, - search_delay = 0, - max_tries = 5, - params = { - 'qry__enabled': $idaa_loc.recovery_meetings.qry__enabled ?? 'enabled', - 'qry__hidden': $idaa_loc.recovery_meetings.qry__hidden ?? 'not_hidden', - 'qry__limit': $idaa_loc.recovery_meetings.qry__limit ?? 35, - }, - try_cache = true, - log_lvl = 1, - }: { - ft_qry_str?: string, - and_physical?: null|boolean, - and_virtual?: null|boolean, - and_type?: null|string, - order_by_li?: key_val, - search_delay?: number, // In milliseconds - max_tries?: number, - params?: key_val, - try_cache?: boolean, - log_lvl?: number, - } - ) { - console.log('handle_qry__event()'); +// async function handle_qry__event( +// { +// ft_qry_str = '', +// and_physical = $idaa_loc.recovery_meetings.qry__physical, +// and_virtual = $idaa_loc.recovery_meetings.qry__virtual, +// and_type = $idaa_loc.recovery_meetings.qry__type, +// order_by_li = $idaa_loc.recovery_meetings.qry__order_by_li, +// search_delay = 0, +// max_tries = 5, +// params = { +// 'qry__enabled': $idaa_loc.recovery_meetings.qry__enabled ?? 'enabled', +// 'qry__hidden': $idaa_loc.recovery_meetings.qry__hidden ?? 'not_hidden', +// 'qry__limit': $idaa_loc.recovery_meetings.qry__limit ?? 35, +// }, +// try_cache = true, +// log_lvl = 1, +// }: { +// ft_qry_str?: string, +// and_physical?: null|boolean, +// and_virtual?: null|boolean, +// and_type?: null|string, +// order_by_li?: key_val, +// search_delay?: number, // In milliseconds +// max_tries?: number, +// params?: key_val, +// try_cache?: boolean, +// log_lvl?: number, +// } +// ) { +// console.log('handle_qry__event()'); - if ($idaa_sess.recovery_meetings?.qry__status != null && $idaa_sess.recovery_meetings?.qry__status != 'done') { - console.log('*** TEST SEARCH - $idaa_sess.recovery_meetings.qry__status != done ***'); - // WARNING: This is a temporary fix for the search string. It needs to be fixed in the future. Using lk_search_str for now. - $idaa_sess.recovery_meetings.status_qry__last_request_str = ft_qry_str; +// if ($idaa_sess.recovery_meetings?.qry__status != null && $idaa_sess.recovery_meetings?.qry__status != 'done') { +// console.log('*** TEST SEARCH - $idaa_sess.recovery_meetings.qry__status != done ***'); +// // WARNING: This is a temporary fix for the search string. It needs to be fixed in the future. Using lk_search_str for now. +// $idaa_sess.recovery_meetings.status_qry__last_request_str = ft_qry_str; - // We want to delay the initial search request to give the previous search request to finish. - let random_delay = Math.floor(Math.random() * 50); - search_delay += 50+random_delay; - } +// // We want to delay the initial search request to give the previous search request to finish. +// let random_delay = Math.floor(Math.random() * 50); +// search_delay += 50+random_delay; +// } - log_lvl = 1; +// log_lvl = 1; - let count = 0; - let request_loop = setInterval(() => { - count++; - if (log_lvl) { - console.log(`*** TEST SEARCH - Search delay: ${search_delay} *** loop count=${count}`); - } - if (count >= max_tries) { - console.log('*** TEST SEARCH - Max tries reached ***'); - clearInterval(request_loop); - } +// let count = 0; +// let request_loop = setInterval(() => { +// count++; +// if (log_lvl) { +// console.log(`*** TEST SEARCH - Search delay: ${search_delay} *** loop count=${count}`); +// } +// if (count >= max_tries) { +// console.log('*** TEST SEARCH - Max tries reached ***'); +// clearInterval(request_loop); +// } - if ($idaa_sess.recovery_meetings?.qry__status != null && $idaa_sess.recovery_meetings?.qry__status != 'done') { - let random_delay = Math.floor(Math.random() * 25); - search_delay += 25+random_delay; - console.log(`*** TEST SEARCH - $idaa_sess.recovery_meetings.qry__status == loading wait *** search_delay=${search_delay}`); - // $idaa_sess.status_qry__last_request_str = ft_qry_str; - } else { - console.log('*** TEST SEARCH - $idaa_sess.recovery_meetings.qry__status != loading ***'); +// if ($idaa_sess.recovery_meetings?.qry__status != null && $idaa_sess.recovery_meetings?.qry__status != 'done') { +// let random_delay = Math.floor(Math.random() * 25); +// search_delay += 25+random_delay; +// console.log(`*** TEST SEARCH - $idaa_sess.recovery_meetings.qry__status == loading wait *** search_delay=${search_delay}`); +// // $idaa_sess.status_qry__last_request_str = ft_qry_str; +// } else { +// console.log('*** TEST SEARCH - $idaa_sess.recovery_meetings.qry__status != loading ***'); - $idaa_sess.recovery_meetings.qry__status = 'loading'; +// $idaa_sess.recovery_meetings.qry__status = 'loading'; - (and_physical) ?? null; - (and_virtual) ?? null; - (and_type) ?? null; - // if (and_type) and_type = and_type; - // if (!and_type) { - // and_type = null; - // } +// (and_physical) ?? null; +// (and_virtual) ?? null; +// (and_type) ?? null; +// // if (and_type) and_type = and_type; +// // if (!and_type) { +// // and_type = null; +// // } - console.log(`TEST - and_physical: ${and_physical}; and_virtual: ${and_virtual}; and_type: ${and_type}; ft_qry_str: ${ft_qry_str}; params:`, params); +// console.log(`TEST - and_physical: ${and_physical}; and_virtual: ${and_virtual}; and_type: ${and_type}; ft_qry_str: ${ft_qry_str}; params:`, params); - // search_submit_results = events_func.qry_ae_obj_li__event({ - // api_cfg: $ae_api, - // for_obj_type: 'account', - // for_obj_id: $ae_loc.account_id, - // order_by_li: order_by_li, - // qry_conference: false, - // qry_physical: and_physical, - // qry_virtual: and_virtual, - // qry_type: and_type, - // qry_str: ft_qry_str, - // params: params, - // try_cache: try_cache, - // log_lvl: log_lvl, - // }) - // .then(function (search_results) { - // // Processing the results from the search. - // $idaa_sess.recovery_meetings.qry__status = 'processing'; - // $idaa_slct.event_obj_li = search_results; - // console.log(search_results); - // // $idaa_sess.recovery_meetings.qry__status = 'done'; +// // search_submit_results = events_func.qry_ae_obj_li__event({ +// // api_cfg: $ae_api, +// // for_obj_type: 'account', +// // for_obj_id: $ae_loc.account_id, +// // order_by_li: order_by_li, +// // qry_conference: false, +// // qry_physical: and_physical, +// // qry_virtual: and_virtual, +// // qry_type: and_type, +// // qry_str: ft_qry_str, +// // params: params, +// // try_cache: try_cache, +// // log_lvl: log_lvl, +// // }) +// // .then(function (search_results) { +// // // Processing the results from the search. +// // $idaa_sess.recovery_meetings.qry__status = 'processing'; +// // $idaa_slct.event_obj_li = search_results; +// // console.log(search_results); +// // // $idaa_sess.recovery_meetings.qry__status = 'done'; - // if (log_lvl) { - // console.log('TEST SEARCH - Search done. Pulling out the event_id_randoms.'); - // } - // // console.log(`TEST search: ${$lq_kv__event_obj_li}`); +// // if (log_lvl) { +// // console.log('TEST SEARCH - Search done. Pulling out the event_id_randoms.'); +// // } +// // // console.log(`TEST search: ${$lq_kv__event_obj_li}`); - // // event_id_random_li = []; +// // // event_id_random_li = []; - // // We need to loop through the array of objects and get the event_id_random from each object a new list of event_id_randoms. Then we can use this list to get the full objects from the database. - // let tmp_li = []; // This is to prevent the array from constantly updating and triggering the liveQuery. - // if (search_results && search_results.length) { - // for (let i = 0; i < search_results.length; i++) { - // tmp_li.push($idaa_slct.event_obj_li[i].event_id_random); - // } - // } - // event_id_random_li = tmp_li; - // }) - // .finally(() => { +// // // We need to loop through the array of objects and get the event_id_random from each object a new list of event_id_randoms. Then we can use this list to get the full objects from the database. +// // let tmp_li = []; // This is to prevent the array from constantly updating and triggering the liveQuery. +// // if (search_results && search_results.length) { +// // for (let i = 0; i < search_results.length; i++) { +// // tmp_li.push($idaa_slct.event_obj_li[i].event_id_random); +// // } +// // } +// // event_id_random_li = tmp_li; +// // }) +// // .finally(() => { - // // event_id_random_li = $idaa_slct.event_obj_li.map(session_obj => session_obj.event_id_random); +// // // event_id_random_li = $idaa_slct.event_obj_li.map(session_obj => session_obj.event_id_random); - // // Finally done with the search. - // $idaa_sess.recovery_meetings.qry__status = 'done'; +// // // Finally done with the search. +// // $idaa_sess.recovery_meetings.qry__status = 'done'; - // if (log_lvl > 1) { - // console.log(`TEST SEARCH - event_id_random_li:`, event_id_random_li); - // // console.log(`TEST SEARCH - search live query: ${$lq_kv__event_obj_li}`); - // } +// // if (log_lvl > 1) { +// // console.log(`TEST SEARCH - event_id_random_li:`, event_id_random_li); +// // // console.log(`TEST SEARCH - search live query: ${$lq_kv__event_obj_li}`); +// // } - // }); - clearInterval(request_loop); - } - }, search_delay); -} +// // }); +// clearInterval(request_loop); +// } +// }, search_delay); +// }