make sure we are working with the right type

This commit is contained in:
Jakob Ketterl 2023-09-09 00:45:33 +02:00
parent d0c0d6fe5f
commit 86e606a22e

View file

@ -30,9 +30,13 @@ class AdsbLocation(IncrementalUpdate, AirplaneLocation):
super().__init__(message)
def update(self, previousLocation: Location):
history = previousLocation.history
now = datetime.now()
history = [p for p in history if now - p["timestamp"] < self.getTTL()]
if isinstance(previousLocation, AdsbLocation):
history = previousLocation.history
now = datetime.now()
history = [p for p in history if now - p["timestamp"] < self.getTTL()]
else:
history = []
history += [{
"timestamp": self.timestamp,
"props": self.props,