config: introduce maxAge setting
This commit is contained in:
parent
913f9f70f6
commit
115444f1cb
@ -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.
|
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
|
# Building
|
||||||
|
|
||||||
Just run the following command from the meshviewer directory:
|
Just run the following command from the meshviewer directory:
|
||||||
|
@ -2,5 +2,6 @@ define({
|
|||||||
"dataPath": "https://map.luebeck.freifunk.net/data/",
|
"dataPath": "https://map.luebeck.freifunk.net/data/",
|
||||||
"siteName": "Freifunk Lübeck",
|
"siteName": "Freifunk Lübeck",
|
||||||
"mapSigmaScale": 0.5,
|
"mapSigmaScale": 0.5,
|
||||||
"showContact": true
|
"showContact": true,
|
||||||
|
"maxAge": 14
|
||||||
})
|
})
|
||||||
|
@ -22,7 +22,7 @@ function (config, moment, Router, L, GUI, numeral) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
var now = moment()
|
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 newnodes = limit("firstseen", age, sortByKey("firstseen", nodes).filter(online))
|
||||||
var lostnodes = limit("lastseen", age, sortByKey("lastseen", nodes).filter(offline))
|
var lostnodes = limit("lastseen", age, sortByKey("lastseen", nodes).filter(offline))
|
||||||
|
Loading…
Reference in New Issue
Block a user