Fix: Ensure IDAA Recovery Meetings respect the user-defined limit
- Simplified limit logic in search__event and qry_ae_obj_li__event_v2 to use the passed value directly. - Added .slice(0, limit) to filtered results in Event module to handle over-fetching correctly. - Explicitly passed the qry__limit from idaa_loc to the meeting list components. - Applied .limit() to the Dexie liveQuery in the meeting list wrapper. - Updated the UI result count and loop to strictly adhere to the requested limit.
This commit is contained in:
@@ -479,7 +479,7 @@ export async function search__event({
|
||||
enabled,
|
||||
hidden,
|
||||
view,
|
||||
limit: (qry_person_id || qry_conference !== null || qry_physical !== null || qry_virtual !== null || qry_type !== null) ? 500 : limit,
|
||||
limit,
|
||||
offset,
|
||||
order_by_li,
|
||||
log_lvl
|
||||
@@ -495,7 +495,7 @@ export async function search__event({
|
||||
enabled,
|
||||
hidden,
|
||||
view,
|
||||
limit: (qry_person_id || qry_conference !== null || qry_physical !== null || qry_virtual !== null || qry_type !== null) ? 500 : limit,
|
||||
limit,
|
||||
offset,
|
||||
order_by_li,
|
||||
log_lvl
|
||||
@@ -572,7 +572,7 @@ export async function search__event({
|
||||
console.log(`Filter results (V3 Search): Input=${processed_obj_li.length}, Output=${filtered_obj_li.length}`);
|
||||
}
|
||||
|
||||
return filtered_obj_li;
|
||||
return filtered_obj_li.slice(0, limit);
|
||||
}
|
||||
|
||||
export const qry_ae_obj_li__event = search__event;
|
||||
@@ -637,7 +637,7 @@ export async function qry_ae_obj_li__event_v2({
|
||||
for_obj_id,
|
||||
enabled,
|
||||
hidden,
|
||||
limit: (qry_person_id || qry_conference !== null || qry_physical !== null || qry_virtual !== null || qry_type !== null) ? 500 : limit,
|
||||
limit,
|
||||
offset,
|
||||
order_by_li,
|
||||
params_json,
|
||||
@@ -707,7 +707,7 @@ export async function qry_ae_obj_li__event_v2({
|
||||
console.log(`Filter results (V2): Input=${processed_obj_li.length}, Output=${filtered_obj_li.length}`);
|
||||
}
|
||||
|
||||
return filtered_obj_li;
|
||||
return filtered_obj_li.slice(0, limit);
|
||||
}
|
||||
|
||||
// Updated 2025-05-09
|
||||
|
||||
@@ -487,6 +487,7 @@
|
||||
{event_id_random_li}
|
||||
link_to_type={'account'}
|
||||
link_to_id={$ae_loc.account_id}
|
||||
limit={$idaa_loc.recovery_meetings.qry__limit}
|
||||
{log_lvl}
|
||||
/>
|
||||
{:else}
|
||||
|
||||
@@ -120,16 +120,16 @@
|
||||
{#if $lq__event_obj_li?.length}
|
||||
<span
|
||||
class="text-3xl font-bold bg-success-100 px-4 border rounded-lg border-success-200"
|
||||
title="Count {$lq__event_obj_li.length ?? 'None'}"
|
||||
title="Count {($lq__event_obj_li.length > $idaa_loc.recovery_meetings.qry__limit ? $idaa_loc.recovery_meetings.qry__limit : $lq__event_obj_li.length) ?? 'None'}"
|
||||
>
|
||||
<span class="fas fa-list-ol mx-4"></span>
|
||||
{$lq__event_obj_li.length ?? 'None'}
|
||||
{($lq__event_obj_li.length > $idaa_loc.recovery_meetings.qry__limit ? $idaa_loc.recovery_meetings.qry__limit : $lq__event_obj_li.length) ?? 'None'}
|
||||
</span>
|
||||
{/if}
|
||||
</h2>
|
||||
|
||||
{#each $lq__event_obj_li as idaa_event_obj, index}
|
||||
{#if idaa_event_obj}
|
||||
{#if idaa_event_obj && index < $idaa_loc.recovery_meetings.qry__limit}
|
||||
<!-- This check for the idaa_event_obj is here in case the IDB entry is deleted. -->
|
||||
<div
|
||||
class="container recovery_meeting event_obj border rounded-lg p-2 mb-2 space-y-2 w-full max-w-(--breakpoint-lg) flex flex-col items-center justify-center bg-white"
|
||||
|
||||
@@ -85,6 +85,7 @@
|
||||
.and((event) => {
|
||||
return event.enable == true;
|
||||
})
|
||||
.limit(limit > 0 ? limit : 500)
|
||||
.sortBy('name');
|
||||
// This should be sorted by a custom sort field
|
||||
} else {
|
||||
@@ -97,6 +98,7 @@
|
||||
.and((event) => {
|
||||
return event.enable == true;
|
||||
})
|
||||
.limit(limit > 0 ? limit : 500)
|
||||
.sortBy('updated_on');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user