Trying to get everything using the newer session list. Also trying to generally pass the LQ values directly to the child component.
This commit is contained in:
2
package-lock.json
generated
2
package-lock.json
generated
@@ -47,7 +47,7 @@
|
||||
"tailwindcss": "^3.4.10",
|
||||
"tslib": "^2.4.1",
|
||||
"typescript": "^5.0.0",
|
||||
"typescript-svelte-plugin": "^0.3.39",
|
||||
"typescript-svelte-plugin": "^0.3.41",
|
||||
"vite": "^5.1.0",
|
||||
"vite-plugin-tailwind-purgecss": "^0.3.3",
|
||||
"vitest": "^2.0.2"
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
"tailwindcss": "^3.4.10",
|
||||
"tslib": "^2.4.1",
|
||||
"typescript": "^5.0.0",
|
||||
"typescript-svelte-plugin": "^0.3.39",
|
||||
"typescript-svelte-plugin": "^0.3.41",
|
||||
"vite": "^5.1.0",
|
||||
"vite-plugin-tailwind-purgecss": "^0.3.3",
|
||||
"vitest": "^2.0.2"
|
||||
|
||||
@@ -9,19 +9,19 @@ import Element_ae_crud from '$lib/element_ae_crud.svelte';
|
||||
import Comp_event_presenter_obj_li from './ae_comp__event_presenter_obj_li.svelte';
|
||||
import Element_manage_event_file_li from '$lib/element_manage_event_file_li_direct.svelte';
|
||||
|
||||
import { liveQuery } from "dexie";
|
||||
// import { liveQuery } from "dexie";
|
||||
import { core_func } from '$lib/ae_core_functions';
|
||||
import { db_events } from "$lib/db_events";
|
||||
// import { db_events } from "$lib/db_events";
|
||||
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
||||
import { events_loc, events_sess, events_slct, events_trigger, events_trig_kv } from '$lib/ae_events_stores';
|
||||
import { events_func } from '$lib/ae_events_functions';
|
||||
|
||||
// Exports
|
||||
export let lq__event_obj: any;
|
||||
// export let lq__event_obj: any;
|
||||
export let lq__event_session_obj_li: any; // This is probably not needed???
|
||||
export let container_class_li: string|Array<string> = [];
|
||||
export let link_to_type: string; // This is probably not needed???
|
||||
export let link_to_id: string; // This is probably not needed???
|
||||
// export let link_to_type: string; // This is probably not needed???
|
||||
// export let link_to_id: string; // This is probably not needed???
|
||||
export let event_session_id_random_li: Array<string>; // ['']
|
||||
export let hide__session_location: boolean = false;
|
||||
export let hide__session_poc: boolean = false;
|
||||
@@ -172,12 +172,12 @@ if (browser) {
|
||||
</a>
|
||||
|
||||
{#if show__session_presentations && $ae_loc.manager_access}
|
||||
<Comp_event_presenter_obj_li
|
||||
<!-- <Comp_event_presenter_obj_li
|
||||
link_to_type={'event_session'}
|
||||
link_to_id={session_obj?.event_session_id_random}
|
||||
display_mode={'minimal'}
|
||||
>
|
||||
</Comp_event_presenter_obj_li>
|
||||
</Comp_event_presenter_obj_li> -->
|
||||
{/if}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
/** @type {import('./$types').PageData} */
|
||||
export let data: any;
|
||||
let log_lvl = 0;
|
||||
let log_lvl = 2;
|
||||
// console.log(`ae_events_pres_mgmt event [slug] +page.svelte data:`, data);
|
||||
|
||||
import { browser } from '$app/environment';
|
||||
@@ -10,7 +10,7 @@ import { browser } from '$app/environment';
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
import { ae_util } from '$lib/ae_utils';
|
||||
// import Element_data_store from '$lib/element_data_store_v2.svelte';
|
||||
import Comp_event_session_obj_li from '../../ae_comp__event_session_obj_li.svelte';
|
||||
import Comp_event_session_obj_li from '../../ae_comp__event_session_obj_li_v2.svelte';
|
||||
|
||||
import { liveQuery } from "dexie";
|
||||
import { core_func } from '$lib/ae_core_functions';
|
||||
@@ -66,17 +66,56 @@ $: if ($lq__event_obj?.mod_pres_mgmt_json) {
|
||||
// .toArray()
|
||||
// );
|
||||
|
||||
let event_session_id_random_li: string[] = [];
|
||||
// let event_session_id_random_li: string[] = [];
|
||||
// event_session_id_random_li = [];
|
||||
// let event_session_id_random_li: string[]|any = ['RZTY-31-68-30'];
|
||||
// let event_session_id_random_li: Array<string> = ['RZTY-31-68-30'];
|
||||
let event_session_id_random_li: Array<string> = [];
|
||||
|
||||
// let lq_kv__event_session_obj_li = liveQuery(
|
||||
// () => db_events.sessions
|
||||
// // .bulkGet(event_session_id_random_li)
|
||||
// .where('event_session_id_random')
|
||||
// .anyOf(event_session_id_random_li)
|
||||
// // .toArray() ?? ['No sessions found.']
|
||||
// .sortBy('start_datetime')
|
||||
// .bulkGet(event_session_id_random_li)
|
||||
// );
|
||||
|
||||
// OMG THIS WORKS!!! 2024-09-17
|
||||
// Using the $: seems to have fixed it along with the async await?
|
||||
$: lq_kv__event_session_obj_li = liveQuery(async () => {
|
||||
let results = await db_events.sessions
|
||||
.bulkGet(event_session_id_random_li);
|
||||
|
||||
return results;
|
||||
});
|
||||
|
||||
// let lq_kv__event_session_obj_li = liveQuery(
|
||||
// () => db_events.sessions
|
||||
// .bulkGet(event_session_id_random_li)
|
||||
// .then(results => {
|
||||
// if (log_lvl) {
|
||||
// console.log(`TEST LQ - bulkGet Results:`, results);
|
||||
// }
|
||||
// // If the results are an array
|
||||
// if (results.length == 1) {
|
||||
// // If the first item is undefined we need to do something.
|
||||
// // if (results[0] == undefined) {
|
||||
// // console.log('TEST LQ - Something went wrong! No sessions found?');
|
||||
// // // return [];
|
||||
// // // return [{ id: '' }];
|
||||
// // // return 'NOTHING???';
|
||||
// // }
|
||||
// // return results;
|
||||
// }else if (results.length > 1) {
|
||||
// // return results;
|
||||
// } else {
|
||||
// // return ['No sessions found.'];
|
||||
// }
|
||||
// // return results;
|
||||
// })
|
||||
// .catch(error => {
|
||||
// console.error(`TEST LQ - bulkGet Error: ${error}`);
|
||||
// // return ['TEST LQ - No sessions found.'];
|
||||
// // return null;
|
||||
// })
|
||||
// .finally(() => {
|
||||
// console.log(`TEST LQ - bulkGet Finally:`, $lq_kv__event_session_obj_li);
|
||||
// })
|
||||
// );
|
||||
|
||||
// let lq_kv__event_session_obj_li = liveQuery(
|
||||
@@ -265,10 +304,14 @@ async function handle_search__event_session(
|
||||
search_delay += 50+random_delay;
|
||||
}
|
||||
|
||||
log_lvl = 2;
|
||||
|
||||
let count = 0;
|
||||
let request_loop = setInterval(() => {
|
||||
count++;
|
||||
console.log(`*** TEST SEARCH - Search delay: ${search_delay} *** count=${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);
|
||||
@@ -305,21 +348,25 @@ async function handle_search__event_session(
|
||||
$events_slct.event_session_obj_li = search_results;
|
||||
console.log(search_results);
|
||||
// $events_sess.pres_mgmt.status_qry__search = 'done';
|
||||
})
|
||||
.finally(() => {
|
||||
|
||||
if (log_lvl) {
|
||||
console.log('TEST SEARCH - Search done. Pulling out the event_session_id_randoms.');
|
||||
}
|
||||
// console.log(`TEST search: ${$lq_kv__event_session_obj_li}`);
|
||||
|
||||
event_session_id_random_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.
|
||||
let tmp_li = []; // This is to prevent the array from constantly updating and triggering the liveQuery.
|
||||
for (let i = 0; i < $events_slct.event_session_obj_li.length; i++) {
|
||||
tmp_li.push($events_slct.event_session_obj_li[i].event_session_id_random);
|
||||
if (search_results && search_results.length) {
|
||||
for (let i = 0; i < search_results.length; i++) {
|
||||
tmp_li.push($events_slct.event_session_obj_li[i].event_session_id_random);
|
||||
}
|
||||
}
|
||||
event_session_id_random_li = tmp_li;
|
||||
})
|
||||
.finally(() => {
|
||||
|
||||
|
||||
// event_session_id_random_li = $events_slct.event_session_obj_li.map(session_obj => session_obj.event_session_id_random);
|
||||
|
||||
@@ -506,13 +553,15 @@ async function handle_search__event_session(
|
||||
{/if}
|
||||
{/await} -->
|
||||
|
||||
{#if $events_slct.event_session_obj_li?.length && $events_slct.event_session_obj_li?.length == event_session_id_random_li?.length}
|
||||
count: {$lq_kv__event_session_obj_li?.length}???
|
||||
count ids: {event_session_id_random_li?.length ?? 'nothing???'}???
|
||||
|
||||
<!-- {#if $events_slct.event_session_obj_li?.length && $events_slct.event_session_obj_li?.length == event_session_id_random_li?.length} -->
|
||||
{#if $lq_kv__event_session_obj_li && $lq_kv__event_session_obj_li?.length > 0 && event_session_id_random_li && event_session_id_random_li?.length > 0}
|
||||
<!-- <div class="sm:bg-red-200 md:bg-yellow-200 lg:bg-green-200 md:max-w-screen-md lg:max-w-screen-lg xl:max-w-screen-xl overflow-x-scroll outline"> -->
|
||||
<div class="sm:bg-red-200 md:bg-yellow-200 lg:bg-white">
|
||||
<Comp_event_session_obj_li
|
||||
lq__event_obj={lq__event_obj}
|
||||
link_to_type={'event'}
|
||||
link_to_id={$events_slct.event_id}
|
||||
lq__event_session_obj_li={lq_kv__event_session_obj_li}
|
||||
event_session_id_random_li={event_session_id_random_li}
|
||||
hide__session_location={$events_loc.pres_mgmt.hide__session_location}
|
||||
hide__session_poc={$events_loc.pres_mgmt.hide__session_poc}
|
||||
|
||||
@@ -177,9 +177,6 @@ onMount(() => {
|
||||
|
||||
{#if $lq__event_session_obj_li && $lq__event_session_obj_li?.length > 0 && event_session_id_random_li && event_session_id_random_li?.length > 0}
|
||||
<Comp_event_session_obj_li
|
||||
lq__event_obj={lq__event_obj}
|
||||
link_to_type={'event_location'}
|
||||
link_to_id={$events_slct.event_location_id}
|
||||
event_session_id_random_li={event_session_id_random_li}
|
||||
lq__event_session_obj_li={lq__event_session_obj_li}
|
||||
hide__session_poc={$events_loc.pres_mgmt.hide__session_poc}
|
||||
|
||||
@@ -13,8 +13,8 @@ import Element_ae_crud from '$lib/element_ae_crud.svelte';
|
||||
import Element_data_store from '$lib/element_data_store_v2.svelte';
|
||||
|
||||
let ae_promises: key_val = {};
|
||||
let ae_tmp: key_val = {};
|
||||
let ae_triggers: key_val = {};
|
||||
// let ae_tmp: key_val = {};
|
||||
// let ae_triggers: key_val = {};
|
||||
|
||||
import { core_func } from '$lib/ae_core_functions';
|
||||
import { db_events } from "$lib/db_events";
|
||||
@@ -22,15 +22,11 @@ import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$
|
||||
import { events_loc, events_sess, events_slct, events_trigger, events_trig_kv } from '$lib/ae_events_stores';
|
||||
import { events_func } from '$lib/ae_events_functions';
|
||||
|
||||
// import Comp_event_session_obj_li from './ae_comp__event_session_obj_li.svelte';
|
||||
|
||||
|
||||
// Exports
|
||||
// export let event_location_id: string;
|
||||
// export let event_location_obj: key_val;
|
||||
// export let display_mode: string = 'default'; // 'default', 'compact', 'minimal', 'launcher'
|
||||
|
||||
|
||||
if (!$events_sess.pres_mgmt) {
|
||||
$events_sess.pres_mgmt = {};
|
||||
// $events_sess.pres_mgmt.show_content__agree_text = null;
|
||||
|
||||
Reference in New Issue
Block a user