Hotfix: live telemetry feed sorted by timestamp

This commit is contained in:
Itay Mizeretz 2018-01-19 10:58:24 +02:00
parent 7daafb0155
commit a5eaea8796
1 changed files with 3 additions and 1 deletions

View File

@ -3,6 +3,7 @@ from datetime import datetime
import dateutil
import flask_restful
from flask import request
import flask_pymongo
from cc.database import mongo
from cc.services.node import NodeService
@ -16,7 +17,8 @@ class TelemetryFeed(flask_restful.Resource):
if "null" == timestamp or timestamp is None: # special case to avoid ugly JS code...
telemetries = mongo.db.telemetry.find({})
else:
telemetries = mongo.db.telemetry.find({'timestamp': {'$gt': dateutil.parser.parse(timestamp)}})
telemetries = mongo.db.telemetry.find({'timestamp': {'$gt': dateutil.parser.parse(timestamp)}})\
.sort([('timestamp', flask_pymongo.ASCENDING)])
return \
{