From 56386a58bdf3f636d94f31079826410b62d68b99 Mon Sep 17 00:00:00 2001 From: satellitestudiodesign Date: Sat, 16 Nov 2024 13:00:52 +0100 Subject: [PATCH 1/7] mark 'soloSinAsignar' on by default --- src/app/casos-activos/solicitudes/index.tsx | 2 +- src/app/casos-activos/solicitudes/page.tsx | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/app/casos-activos/solicitudes/index.tsx b/src/app/casos-activos/solicitudes/index.tsx index 369270f..9a35de4 100644 --- a/src/app/casos-activos/solicitudes/index.tsx +++ b/src/app/casos-activos/solicitudes/index.tsx @@ -44,7 +44,7 @@ export function Solicitudes({ data, count }: SolicitudesProps) { urgencia: searchParams.get('urgencia') || 'todas', tipoAyuda: searchParams.get('tipoAyuda') || 'todas', pueblo: searchParams.get('pueblo') || 'todos', - soloSinAsignar: searchParams.get('soloSinAsignar') || 'false', + soloSinAsignar: searchParams.get('soloSinAsignar') || 'true', }); const updateFilter = useCallback( diff --git a/src/app/casos-activos/solicitudes/page.tsx b/src/app/casos-activos/solicitudes/page.tsx index 4c6aac7..2e556c6 100644 --- a/src/app/casos-activos/solicitudes/page.tsx +++ b/src/app/casos-activos/solicitudes/page.tsx @@ -28,8 +28,8 @@ const getData = async (supabase: SupabaseClient, filters: FiltersData) .eq('type', 'necesita') .neq('status', 'finished'); - // Solo agregar filtro si es true - if (filters.soloSinAsignar !== undefined && filters.soloSinAsignar === 'true') { + // Solo agregar filtro si es true o no se especificó + if (filters.soloSinAsignar === undefined || filters.soloSinAsignar === 'true') { query.eq('assignments_count', 0); } @@ -44,19 +44,22 @@ const getData = async (supabase: SupabaseClient, filters: FiltersData) const getCount = async (supabase: SupabaseClient, filters: FiltersData) => { const query = supabase - .from('help_requests_with_assignment_count') - .select('id', { count: 'exact' }) - .eq('type', 'necesita'); - // Solo agregar filtro si es true - if (filters.soloSinAsignar !== undefined && filters.soloSinAsignar === 'true') { - query.eq('assignments_count', 0); + .from('help_requests_with_assignment_count') + .select('id', { count: 'exact' }) + .eq('type', 'necesita') + .neq('status', 'finished'); + + // Solo agregar filtro si es true o no se especificó + if (filters.soloSinAsignar === undefined || filters.soloSinAsignar === 'true') { + query.eq('assignments_count', 0); } const { count: solicitaCount, error: solicitaError } = await query; const { count: ofreceCount, error: ofreceError } = await supabase .from('help_requests') .select('id', { count: 'exact' }) - .eq('type', 'ofrece'); + .eq('type', 'ofrece') + .neq('status', 'finished'); if (solicitaError) { throw new Error('Error fetching solicita:', solicitaError); From 87d89ce156ab1ed533dca4956e6f66c609c5911c Mon Sep 17 00:00:00 2001 From: satellitestudiodesign Date: Sat, 16 Nov 2024 13:00:59 +0100 Subject: [PATCH 2/7] fix "Volver" button spacing on mobile --- src/app/solicitudes/[id]/page.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/solicitudes/[id]/page.tsx b/src/app/solicitudes/[id]/page.tsx index 037fc3b..2bbd656 100644 --- a/src/app/solicitudes/[id]/page.tsx +++ b/src/app/solicitudes/[id]/page.tsx @@ -40,7 +40,7 @@ export default function CasoDetalle() { } if (data === null) { return ( -
+