Hide market days if at a conference

This commit is contained in:
Edward Betts 2023-12-30 17:13:46 +00:00
parent a452634da4
commit 23d0219252

View file

@ -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)