From 115444f1cbdbb96cbcdb01f171f76ddc24ee5858 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Sun, 26 Apr 2015 13:12:11 +0200 Subject: [PATCH] config: introduce maxAge setting --- README.md | 5 +++++ config.js.example | 3 ++- lib/main.js | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9ebc487..fc1ba62 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/config.js.example b/config.js.example index eeaa8fa..60dee6a 100644 --- a/config.js.example +++ b/config.js.example @@ -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 }) diff --git a/lib/main.js b/lib/main.js index 1d12c49..bb2e740 100644 --- a/lib/main.js +++ b/lib/main.js @@ -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))