From ffd99d49b824214d493d6734e407d78cb6c3368f Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Mon, 11 Aug 2025 22:03:17 +0000 Subject: [PATCH] Filter calendar ads to show only those with store participation Modify the calendar grid component to ensure that only advertisements with active store participations are displayed, particularly when no specific store is selected or as a default filtering condition. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b163d4c0-de5e-4f4e-a9c0-aed4c7049718 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/b163d4c0-de5e-4f4e-a9c0-aed4c7049718/ByygiiM --- client/src/components/CalendarGrid.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/client/src/components/CalendarGrid.tsx b/client/src/components/CalendarGrid.tsx index 61b7836..5c9e21b 100644 --- a/client/src/components/CalendarGrid.tsx +++ b/client/src/components/CalendarGrid.tsx @@ -198,9 +198,13 @@ export default function CalendarGrid({ return false; } - // If no store is selected and user has no assigned groups, show all publicities + // If no store is selected and user has no assigned groups, show only publicities with participations if (!selectedStoreId && (!userGroups || userGroups.length === 0)) { - return true; + const hasParticipations = pub.participations && pub.participations.length > 0; + if (hasParticipations) { + console.log('📋 Publicity has participations (no store selected):', { pubNumber: pub.pubNumber, participationCount: pub.participations.length }); + } + return hasParticipations; } // If a specific store is selected, check if that store participates @@ -223,7 +227,12 @@ export default function CalendarGrid({ return matches; } - return true; + // Default case: only show publicities with participations + const hasParticipations = pub.participations && pub.participations.length > 0; + if (hasParticipations) { + console.log('📋 Publicity has participations (default case):', { pubNumber: pub.pubNumber, participationCount: pub.participations.length }); + } + return hasParticipations; }); };