Skip to content

Commit 15460eb

Browse files
committed
Fixed 30 day averages
1 parent 8bf8476 commit 15460eb

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

routes/stats.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ router.get('/', (req, res, next) => {
3838
},
3939
function(cb){
4040
Request.aggregate([
41+
{
42+
"$sort": { "date": -1}
43+
},
44+
{ "$limit": 30 },
4145
{"$group": {
4246
"_id": 'total',
4347
"total": { $sum: "$total" },
4448
"bandwidth": { $sum: "$bandwidth" }
45-
}},
46-
{ "$sort": {
47-
"total": -1
48-
}},
49-
{ "$limit": 30 }
49+
}}
5050
],function(err, result) {
5151
if (result.length !== 0) {
5252
cb(err, {total: format(Math.round(result[0].total/30)), bandwidth: filesize(result[0].bandwidth)});

0 commit comments

Comments
 (0)