API: activity serialization fix

This commit is contained in:
Sam 2018-05-01 21:40:43 +02:00
parent be326ba294
commit 561dc5b7a0

View File

@ -67,14 +67,16 @@ class Activity(db.Model):
"creation_date": self.creation_date, "creation_date": self.creation_date,
"modification_date": self.modification_date, "modification_date": self.modification_date,
"activity_date": self.activity_date, "activity_date": self.activity_date,
"duration": self.duration.total_seconds(), "duration": (self.duration.total_seconds()
"pauses": self.pauses.total_seconds(), if self.duration
"moving": self.moving.total_seconds(), else None),
"distance": float(self.distance), "pauses": self.pauses.total_seconds() if self.pauses else None,
"min_alt": float(self.min_alt), "moving": self.moving.total_seconds() if self.moving else None,
"max_alt": float(self.max_alt), "distance": float(self.distance) if self.distance else None,
"descent": float(self.descent), "min_alt": float(self.min_alt) if self.min_alt else None,
"ascent": float(self.ascent), "max_alt": float(self.max_alt) if self.max_alt else None,
"max_speed": float(self.max_speed), "descent": float(self.descent) if self.descent else None,
"ave_speed": float(self.ave_speed) "ascent": float(self.ascent) if self.ascent else None,
"max_speed": float(self.max_speed) if self.max_speed else None,
"ave_speed": float(self.ave_speed) if self.ave_speed else None
} }