Hotfix: live telemetry feed sorted by timestamp
This commit is contained in:
parent
7daafb0155
commit
a5eaea8796
|
@ -3,6 +3,7 @@ from datetime import datetime
|
||||||
import dateutil
|
import dateutil
|
||||||
import flask_restful
|
import flask_restful
|
||||||
from flask import request
|
from flask import request
|
||||||
|
import flask_pymongo
|
||||||
|
|
||||||
from cc.database import mongo
|
from cc.database import mongo
|
||||||
from cc.services.node import NodeService
|
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...
|
if "null" == timestamp or timestamp is None: # special case to avoid ugly JS code...
|
||||||
telemetries = mongo.db.telemetry.find({})
|
telemetries = mongo.db.telemetry.find({})
|
||||||
else:
|
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 \
|
return \
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue