Commit f247aaf4 authored by Michael Vernier's avatar Michael Vernier

Better formatting of object data

parent d9261dd1
......@@ -47,7 +47,13 @@ OSUTrip.getRoutes = function()
throw bustimeresponse.error;
}
return bustimeresponse.route;
// return bustimeresponse.route;
var retval = [];
_.each( bustimeresponse.route, function( route )
{
retval.push( { route: route.rt[ 0 ], name: route.rtnm[ 0 ], color: route.rtclr[ 0 ] } );
});
return retval;
}
else
{
......@@ -206,7 +212,30 @@ OSUTrip.getBuses = function( route )
throw bustimeresponse.error;
}
return bustimeresponse.vehicle;
// return bustimeresponse.vehicle;
var retval = [];
_.each( bustimeresponse.vehicle, function( vehicle )
{
retval.push(
{
vehicleid: vehicle.vid[ 0 ],
lastupdate: moment( vehicle.tmstmp[ 0 ], 'YYYYMMDD HH:mm:ss' ).toDate(),
lat: vehicle.lat[ 0 ],
lon: vehicle.lon[ 0 ],
heading: vehicle.hdg[ 0 ],
patternid: vehicle.pid[ 0 ],
paterndist: vehicle.pdist[ 0 ],
route: vehicle.rt[ 0 ],
destination: vehicle.des[ 0 ],
// delayed: vehicle.dly[ 0 ],
speed: vehicle.spd[ 0 ],
tablockid: vehicle.tablockid[ 0 ],
tatripid: vehicle.tatripid[ 0 ],
zone: vehicle.zone[ 0 ]
});
});
return retval;
}
else
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment