Now able to search the Journal Entries!

This commit is contained in:
Scott Idem
2025-06-04 17:54:37 -04:00
parent 8c9f0afc02
commit ac81aadd6f
4 changed files with 202 additions and 10 deletions

View File

@@ -67,11 +67,31 @@ let lq__journal_obj = $derived(liveQuery(async () => {
let lq__journal_entry_obj_li = $derived(liveQuery(async () => {
log_lvl = 1;
if (log_lvl) {
console.log(`$lq__journal_obj.cfg_json = `, $lq__journal_obj?.cfg_json);
console.log(`$journals_loc.filter__category_code = `, $journals_loc.filter__category_code);
}
if ($lq__journal_obj?.cfg_json?.entry_group_sort === 'DESC') {
if ($journals_sess.entry_li_trigger && !$journals_sess?.entry_li) {
$journals_sess.entry_li = null;
$journals_sess.entry_li_trigger = false;
}
if ($journals_sess?.entry_li && $journals_sess?.entry_li?.length) {
// $journals_sess.entry_li_trigger = false;
let journal_entry_id_random_li = []; // This is to prevent the array from constantly updating and triggering the liveQuery.
for (let i = 0; i < $journals_sess?.entry_li.length; i++) {
let journal_entry_obj = $journals_sess?.entry_li[i];
let journal_entry_id_random = journal_entry_obj.journal_entry_id_random;
journal_entry_id_random_li.push(journal_entry_id_random);
}
// let journal_entry_id_random_li = tmp_li;
let results = await db_journals.journal_entry
.bulkGet(journal_entry_id_random_li);
return results;
} else if ($lq__journal_obj?.cfg_json?.entry_group_sort === 'DESC') {
let results = await db_journals.journal_entry
// .orderBy('updated_on')
.where('journal_id')
@@ -117,6 +137,12 @@ $effect(() => {
if ($journals_trig.journal_entry_li) {
$journals_trig.journal_entry_li = false;
// if ($journals_trig?.journal_entry_li.length > 0) {
// $journals_sess.entry_li = $journals_trig.journal_entry_li;
// console.log('TEST TEST TEST');
// return ;
// }
if (log_lvl) {
console.log(`Triggered: $journals_trig.journal_entry_li`);
}