mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-11 18:32:50 +00:00
changed colors and added humidity
This commit is contained in:
@@ -15,7 +15,6 @@ router.get('/allsensors', function(req, res, next) {
|
||||
min : {$min : "$temperature"}}},
|
||||
{$sort : {"_id.month" : 1, "_id.day" : 1, "_id.year" : 1}}]).exec(function(err, info){
|
||||
|
||||
console.log(info);
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.send(JSON.stringify(info, null, 4));
|
||||
|
||||
@@ -35,14 +34,14 @@ router.get('/sensorbylocation/year', function(req, res, next) {
|
||||
|
||||
//query finds a entries in a collection based on location and the year specified
|
||||
//they are then grouped by date and sorted by date as well
|
||||
temperature.aggregate([ {$project : {location : 1, temperature : 1, year : {$year : "$updated"}, month : {$month : "$updated"}, day : {$dayOfMonth : "$updated"}}},
|
||||
temperature.aggregate([ {$project : {location : 1, temperature : 1, humidity : 1, year : {$year : "$updated"}, month : {$month : "$updated"}, day : {$dayOfMonth : "$updated"}}},
|
||||
{$match : {location : loc, year : parseInt(ye)}},
|
||||
{$group : {_id : {location : "$location", day: "$day", month : "$month", year : "$year"},
|
||||
max : {$max : "$temperature"},
|
||||
min : {$min : "$temperature"}}},
|
||||
min : {$min : "$temperature"},
|
||||
humidity : {$avg : "$humidity"}}},
|
||||
{$sort : {"_id.month" : 1, "_id.day" : 1}}]).exec(function(err, info){
|
||||
|
||||
console.log(info);
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.send(JSON.stringify(info, null, 4));
|
||||
|
||||
@@ -65,14 +64,14 @@ router.get('/sensorbylocation/month', function(req, res, next) {
|
||||
mo = date.getMonth();
|
||||
}
|
||||
|
||||
console.log(ye + "/" + mo);
|
||||
//query finds a entries in a collection based on location and the year specified
|
||||
//they are then grouped by date and sorted by date as well
|
||||
temperature.aggregate([ {$project : {location : 1, temperature : 1, year : {$year : "$updated"}, month : {$month : "$updated"}, day : {$dayOfMonth : "$updated"}}},
|
||||
temperature.aggregate([ {$project : {location : 1, temperature : 1, humidity : 1, year : {$year : "$updated"}, month : {$month : "$updated"}, day : {$dayOfMonth : "$updated"}}},
|
||||
{$match : {location : loc, year : parseInt(ye), month : parseInt(mo)}},
|
||||
{$group : {_id : {location : "$location", day: "$day", month : "$month", year : "$year"},
|
||||
max : {$max : "$temperature"},
|
||||
min : {$min : "$temperature"}}},
|
||||
min : {$min : "$temperature"},
|
||||
humidity : {$avg : "$humidity"}}},
|
||||
{$sort : {"_id.day" : 1}}]).exec(function(err, info){
|
||||
|
||||
console.log(info);
|
||||
|
||||
@@ -25,8 +25,6 @@ router.get('/vpn', function(req, res, next){
|
||||
/* GET home page. */
|
||||
router.get('/', function(req, res, next) {
|
||||
|
||||
console.log(req.query.post);
|
||||
|
||||
renderIndex(res, {getPost : req.query.post, validation : {}});
|
||||
|
||||
});
|
||||
@@ -56,7 +54,6 @@ router.post('/', function(req, res,next) {
|
||||
|
||||
|
||||
var time = hours + ":" + minutes + ampm;
|
||||
console.log("--time: " + time);
|
||||
|
||||
if(!numberValidator(number)){
|
||||
invalid.number = 'Invalid Number';
|
||||
@@ -117,7 +114,6 @@ router.post('/', function(req, res,next) {
|
||||
console.dir(entry);
|
||||
});
|
||||
|
||||
console.log(entry);
|
||||
res.render('success');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -83,7 +83,6 @@ router.get('/information', function(req, res, err){
|
||||
{$match : {location : sensor_location}},
|
||||
{$group : {_id : {year : "$year", month : "$month", location : "$location"}}},
|
||||
{$sort : {"_id.year" : -1, "_id.month" : -1}}]).exec(function(err, info){
|
||||
console.log(info);
|
||||
|
||||
//generate list of unique years to display in dropdown menu
|
||||
var years_list = [];
|
||||
|
||||
Reference in New Issue
Block a user