Finally getting the event session list to use the LiveQuery with a list of IDs to work correctly. Now replacing old version. Well... maybe some more testing tomorrow.
This commit is contained in:
@@ -649,7 +649,12 @@ export async function search__event_session(
|
|||||||
like_presenter_search_qry_str = null,
|
like_presenter_search_qry_str = null,
|
||||||
file_count = false, // If true then only show those that have a file count
|
file_count = false, // If true then only show those that have a file count
|
||||||
location_name = null,
|
location_name = null,
|
||||||
params = {},
|
params = {
|
||||||
|
'qry__enabled': 'enabled',
|
||||||
|
'qry__hidden':'not_hidden',
|
||||||
|
'qry__limit': 150,
|
||||||
|
'qry__offset': 0
|
||||||
|
},
|
||||||
try_cache = true,
|
try_cache = true,
|
||||||
log_lvl = 0
|
log_lvl = 0
|
||||||
}: {
|
}: {
|
||||||
@@ -668,7 +673,9 @@ export async function search__event_session(
|
|||||||
log_lvl?: number
|
log_lvl?: number
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
console.log(`*** search__event_session() *** event_id=${event_id}`);
|
if (log_lvl) {
|
||||||
|
console.log(`*** search__event_session() *** event_id=${event_id}`);
|
||||||
|
}
|
||||||
|
|
||||||
let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
|
let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
|
||||||
let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden
|
let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden
|
||||||
|
|||||||
@@ -77,29 +77,29 @@ let event_session_id_random_li: Array<string> = $state([]);
|
|||||||
|
|
||||||
// OMG THIS WORKS!!! 2024-09-17
|
// OMG THIS WORKS!!! 2024-09-17
|
||||||
// Using the $: seems to have fixed it along with the async await?
|
// Using the $: seems to have fixed it along with the async await?
|
||||||
let lq__event_session_obj_li = $derived(liveQuery(async () => {
|
// let lq__event_session_obj_li = $derived(liveQuery(async () => {
|
||||||
// console.log(`*** LiveQuery: lq__event_session_obj_li *** event_session_id_random_li`, $state.snapshot(event_session_id_random_li));
|
// // console.log(`*** LiveQuery: lq__event_session_obj_li *** event_session_id_random_li`, $state.snapshot(event_session_id_random_li));
|
||||||
// if (!event_session_id_random_li) {
|
// // if (!event_session_id_random_li) {
|
||||||
// // return [];
|
// // // return [];
|
||||||
// return;
|
// // return;
|
||||||
// }
|
// // }
|
||||||
if (event_session_id_random_li.length) {
|
// if (event_session_id_random_li.length) {
|
||||||
console.log(`*** LiveQuery: lq__event_session_obj_li *** time to bulkGet`, $state.snapshot(event_session_id_random_li));
|
// console.log(`*** LiveQuery: lq__event_session_obj_li *** time to bulkGet`, $state.snapshot(event_session_id_random_li));
|
||||||
let results = await db_events.sessions
|
// let results = await db_events.sessions
|
||||||
.bulkGet(event_session_id_random_li);
|
// .bulkGet(event_session_id_random_li);
|
||||||
|
|
||||||
return results;
|
// return results;
|
||||||
} else {
|
// } else {
|
||||||
let results = await db_events.sessions
|
// let results = await db_events.sessions
|
||||||
.where('event_id')
|
// .where('event_id')
|
||||||
.equals($events_slct?.event_id ?? '') // null or undefined does not reset things like '' does
|
// .equals($events_slct?.event_id ?? '') // null or undefined does not reset things like '' does
|
||||||
.reverse()
|
// .reverse()
|
||||||
.sortBy('name');
|
// .sortBy('name');
|
||||||
|
|
||||||
return results;
|
// return results;
|
||||||
}
|
// }
|
||||||
|
|
||||||
}));
|
// }));
|
||||||
|
|
||||||
|
|
||||||
let lq__event_location_obj_li = $derived(liveQuery(async () => {
|
let lq__event_location_obj_li = $derived(liveQuery(async () => {
|
||||||
@@ -244,8 +244,8 @@ function process_search_string(search_str: string) {
|
|||||||
// like_presentation_search_qry_str: lk_search_str_new,
|
// like_presentation_search_qry_str: lk_search_str_new,
|
||||||
// like_presenter_search_qry_str: lk_search_str_new,
|
// like_presenter_search_qry_str: lk_search_str_new,
|
||||||
// params: params,
|
// params: params,
|
||||||
try_cache: false,
|
try_cache: true,
|
||||||
log_lvl: 0,
|
log_lvl: log_lvl,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,8 +262,8 @@ async function handle_search__event_session(
|
|||||||
'qry__hidden': $events_loc.pres_mgmt.qry_hidden ?? 'not_hidden',
|
'qry__hidden': $events_loc.pres_mgmt.qry_hidden ?? 'not_hidden',
|
||||||
'qry__limit': $events_loc.pres_mgmt.qry_limit__sessions ?? 35,
|
'qry__limit': $events_loc.pres_mgmt.qry_limit__sessions ?? 35,
|
||||||
},
|
},
|
||||||
try_cache=false,
|
try_cache = true,
|
||||||
log_lvl=1,
|
log_lvl = 0,
|
||||||
}: {
|
}: {
|
||||||
ft_search_str?: string,
|
ft_search_str?: string,
|
||||||
lk_search_str?: string,
|
lk_search_str?: string,
|
||||||
@@ -289,7 +289,7 @@ async function handle_search__event_session(
|
|||||||
search_delay += 50+random_delay;
|
search_delay += 50+random_delay;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_lvl = 2;
|
// log_lvl = 1;
|
||||||
|
|
||||||
let count = 0;
|
let count = 0;
|
||||||
let request_loop = setInterval(() => {
|
let request_loop = setInterval(() => {
|
||||||
@@ -327,7 +327,7 @@ async function handle_search__event_session(
|
|||||||
location_name: and_lk_location_name,
|
location_name: and_lk_location_name,
|
||||||
params: params,
|
params: params,
|
||||||
try_cache: try_cache,
|
try_cache: try_cache,
|
||||||
log_lvl: 0,
|
log_lvl: log_lvl,
|
||||||
})
|
})
|
||||||
.then(function (search_results) {
|
.then(function (search_results) {
|
||||||
// Processing the results from the search.
|
// Processing the results from the search.
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
|
||||||
|
|
||||||
// *** Import Svelte specific
|
// *** Import Svelte specific
|
||||||
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 { ae_util } from '$lib/ae_utils/ae_utils';
|
||||||
@@ -69,7 +70,7 @@ let ae_triggers: key_val = $state({});
|
|||||||
<section
|
<section
|
||||||
class="
|
class="
|
||||||
ae_comp event_session_obj_li
|
ae_comp event_session_obj_li
|
||||||
border border-2 border-dashed border-x-red-500 border-y-white
|
border-2 border-dashed border-x-red-500 border-y-white
|
||||||
sm:border-x-red-400 md:border-x-yellow-400 lg:border-x-gray-100
|
sm:border-x-red-400 md:border-x-yellow-400 lg:border-x-gray-100
|
||||||
px-0.5 py-2 space-y-2
|
px-0.5 py-2 space-y-2
|
||||||
min-w-full
|
min-w-full
|
||||||
|
|||||||
Reference in New Issue
Block a user