diff --git a/agenda/data.py b/agenda/data.py index db5754e..7d9b0a3 100644 --- a/agenda/data.py +++ b/agenda/data.py @@ -270,7 +270,7 @@ def find_markets_during_stay( for market in markets: for e in accommodation_events: # Check if the market date is within the accommodation dates. - if e.date <= market.date <= (e.end_date or e.date): + if e.as_date <= market.as_date <= e.end_as_date: overlapping_markets.append(market) break # Breaks the inner loop if overlap is found. return overlapping_markets @@ -445,8 +445,11 @@ async def get_data( # hide markets that happen while away markets = [e for e in events if e.name == "market"] + going = [e for e in events if e.going] - overlapping_markets = find_markets_during_stay(accommodation_events, markets) + overlapping_markets = find_markets_during_stay( + accommodation_events + going, markets + ) for market in overlapping_markets: events.remove(market)