|
|
|
|
@ -8,15 +8,16 @@ export const load: PageServerLoad = async (event) => {
|
|
|
|
|
}
|
|
|
|
|
const data = await res.json();
|
|
|
|
|
const groups = Array.isArray(data?.items) ? data.items : [];
|
|
|
|
|
// Ordenar fichas por cantidad de tareas sin responsable (desc)
|
|
|
|
|
groups.sort((a: any, b: any) => Number(b?.counts?.unassigned || 0) - Number(a?.counts?.unassigned || 0));
|
|
|
|
|
|
|
|
|
|
// Prefetch de "sin responsable" por grupo (ligero)
|
|
|
|
|
const previews: Record<string, any[]> = {};
|
|
|
|
|
const previewLimit = 3;
|
|
|
|
|
|
|
|
|
|
for (const g of groups) {
|
|
|
|
|
try {
|
|
|
|
|
const r = await event.fetch(
|
|
|
|
|
`/api/groups/${encodeURIComponent(g.id)}/tasks?unassignedFirst=true&onlyUnassigned=true&limit=${previewLimit}`,
|
|
|
|
|
`/api/groups/${encodeURIComponent(g.id)}/tasks?unassignedFirst=true&onlyUnassigned=true`,
|
|
|
|
|
{ headers: { 'cache-control': 'no-store' } }
|
|
|
|
|
);
|
|
|
|
|
if (r.ok) {
|
|
|
|
|
|