mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-11 18:32:50 +00:00
updated date on sensors page
This commit is contained in:
@@ -9,8 +9,9 @@ var temperature = mongoose.model('temperature');
|
|||||||
/* GET sensors page. */
|
/* GET sensors page. */
|
||||||
router.get('/', function(req, res, next) {
|
router.get('/', function(req, res, next) {
|
||||||
|
|
||||||
temperature.aggregate( [{ $group : { _id : "$location", temperature : {$last : "$temperature"}, humidity : {$last : "$humidity"}, updated : {$last : "$updated"}}},
|
temperature.aggregate( [{$project : {sDate : {$subtract : ["$updated", 21600000]}}},
|
||||||
{$sort : {location : -1, updated : -1}} ] ).exec(function(err, info){
|
{ $group : { _id : "$location", temperature : {$last : "$temperature"}, humidity : {$last : "$humidity"}, updated : {$last : "$sDate"}}},
|
||||||
|
{$sort : {location : -1, updated : -1}} ] ).exec(function(err, info){
|
||||||
|
|
||||||
//get month for each entry and convert 24 hour time to US time
|
//get month for each entry and convert 24 hour time to US time
|
||||||
//also check to see if device has sent a data point in past 5 minutes
|
//also check to see if device has sent a data point in past 5 minutes
|
||||||
|
|||||||
Reference in New Issue
Block a user