From 40aba339f845241f52c9846cdc6c0f54f68830f1 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Tue, 2 Jul 2024 09:33:16 -0400 Subject: [PATCH] Work on LiveQuery --- src/lib/ae_utils__datetime_format.ts | 2 +- .../event/[slug]/+page.svelte | 69 +++++++++++++------ 2 files changed, 48 insertions(+), 23 deletions(-) diff --git a/src/lib/ae_utils__datetime_format.ts b/src/lib/ae_utils__datetime_format.ts index ea5018cd..f3337532 100644 --- a/src/lib/ae_utils__datetime_format.ts +++ b/src/lib/ae_utils__datetime_format.ts @@ -121,7 +121,7 @@ export let iso_datetime_formatter = function iso_datetime_formatter( datetime_string = dayjs(raw_datetime).format('dd'); break; default: - console.log(`The named format passed (${named_format}) did not match a common name. Trying to format with the named format value.`); + // console.log(`The named format passed (${named_format}) did not match a common name. Trying to format with the named format value.`); datetime_string = dayjs(raw_datetime).format(named_format); // datetime_string = dayjs(raw_datetime).format('YYYY-MM-DD HH:mm:ss'); } diff --git a/src/routes/events_pres_mgmt/event/[slug]/+page.svelte b/src/routes/events_pres_mgmt/event/[slug]/+page.svelte index 04fc96dc..bdac1206 100644 --- a/src/routes/events_pres_mgmt/event/[slug]/+page.svelte +++ b/src/routes/events_pres_mgmt/event/[slug]/+page.svelte @@ -247,6 +247,15 @@ function handle_search__event_session(search_str: string) { .finally(() => { console.log('Search done.'); console.log(`test1: ${$lq_kv__event_session_obj_li}`); + + event_session_id_random_li = []; + + // We need to loop through the array of objects and get the event_session_id_random from each object a new list of event_session_id_randoms. Then we can use this list to get the full objects from the database. + for (let i = 0; i < $events_slct.event_session_obj_li.length; i++) { + event_session_id_random_li.push($events_slct.event_session_obj_li[i].event_session_id_random); + } + + console.log(`event_session_id_random_li:`, event_session_id_random_li); }); }, 250); } else { @@ -279,8 +288,7 @@ function handle_search__event_session(search_str: string) { event_session_id_random_li = []; - // We need to loop through the array of objects and get the event_session_id_random from each object a new list - // of event_session_id_randoms. Then we can use this list to get the full objects from the database. + // We need to loop through the array of objects and get the event_session_id_random from each object a new list of event_session_id_randoms. Then we can use this list to get the full objects from the database. for (let i = 0; i < $events_slct.event_session_obj_li.length; i++) { event_session_id_random_li.push($events_slct.event_session_obj_li[i].event_session_id_random); } @@ -299,23 +307,6 @@ function handle_search__event_session(search_str: string) { - - -{#if event_session_id_random_li.length} - ID count:{event_session_id_random_li.length} - - {#if $lq_kv__event_session_obj_li?.length} - Sess li: {$lq_kv__event_session_obj_li?.length} - - {:else} - - x: {$lq_kv__event_session_obj_li} - {/if} -{:else} - No IDs found -{/if} - -
@@ -461,8 +452,8 @@ function handle_search__event_session(search_str: string) { {/if} {/await} - -{#if $events_slct?.event_session_obj_li && $events_slct.event_session_obj_li.length > 0} +{#if $events_slct.event_session_obj_li?.length == event_session_id_random_li?.length && event_session_id_random_li.length == $lq_kv__event_session_obj_li?.length} +

@@ -489,7 +480,7 @@ function handle_search__event_session(search_str: string) { -{#each $events_slct.event_session_obj_li as session_obj} +{#each $lq_kv__event_session_obj_li as session_obj} No results to show. Please use the search above to find your session.

+
+Query results length: {$events_slct.event_session_obj_li?.length} +ID list length: {event_session_id_random_li?.length} +LQ results length: {$lq_kv__event_session_obj_li?.length} +
{/if} + + +{#if $events_slct.event_session_obj_li?.length == event_session_id_random_li?.length && event_session_id_random_li.length == $lq_kv__event_session_obj_li?.length} + Count: + {event_session_id_random_li.length} + +
+ {#each $lq_kv__event_session_obj_li as event_session_obj} + + {event_session_obj?.event_session_id_random} + + {/each} +
+{:else} + No match +{/if} + + +