Should all work now

This commit is contained in:
Remy Moll
2021-10-31 07:36:40 +01:00
parent ff7c413fcf
commit ecf4dc31f8
5 changed files with 69 additions and 235 deletions

View File

@@ -8,7 +8,7 @@ class Event:
description = ""
reviews = []
category = []
weather_requirements = 0
weather_requirements = 100 # highest tolerance
date = ""
image_path = "fallback.jpg"
activity_duration = "" # datetime object
@@ -87,4 +87,15 @@ class Events:
return None
def __iter__(self):
return iter(self._events)
# todo fix broken iterator
return iter(self._events)
def filter_events(self, user, weather_score):
# implement user preferences, geographic restrictions and weather conditions
for e in self._events:
if e.weather_requirements <= weather_score \
or abs(e.location_coordinates[0] - user.home_coordinates[0]) + abs(e.location_coordinates[1] - user.home_coordinates[1]) >= 15 \
or not e.trip_is_good:
print("This event should be removed")