config: introduce maxAge setting

This commit is contained in:
Nils Schneider 2015-04-26 13:12:11 +02:00
parent 913f9f70f6
commit 115444f1cb
3 changed files with 8 additions and 2 deletions

View File

@ -62,6 +62,11 @@ area. Values like 1.0 and 0.5 might be good choices.
Setting this to `false` will hide contact information for nodes.
## maxAge (integer)
Nodes being online for less than maxAge days are considered "new". Likewise,
nodes being offline for less than than maxAge days are considered "lost".
# Building
Just run the following command from the meshviewer directory:

View File

@ -2,5 +2,6 @@ define({
"dataPath": "https://map.luebeck.freifunk.net/data/",
"siteName": "Freifunk Lübeck",
"mapSigmaScale": 0.5,
"showContact": true
"showContact": true,
"maxAge": 14
})

View File

@ -22,7 +22,7 @@ function (config, moment, Router, L, GUI, numeral) {
})
var now = moment()
var age = moment(now).subtract(14, "days")
var age = moment(now).subtract(config.maxAge, "days")
var newnodes = limit("firstseen", age, sortByKey("firstseen", nodes).filter(online))
var lostnodes = limit("lastseen", age, sortByKey("lastseen", nodes).filter(offline))