def getAffectedTrip(self, weather, conditions): """ Looks trips on DB that are gonna be affected by the weather """ trip = [] db = DB() # Running trough the weather for i in weather: # Search for pre defined special weather conditions # This can be a function that evaluates temperature and time if self.evaluateWeather(i["icon"], i["temperature"], i["time"], conditions): # Query related trips between i["time"] and an hour later trips = db.selectBusTrip(i["time"]) # Append them on the trips array trip.append([i["icon"], i["temperature"], i["time"], trips]) return trip