diff --git a/README.md b/README.md index e32a57e..ad1138a 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ You can see an up-to-date copy of the production branch running on https://minet 3. Add/remove servers by editing the ```servers.json``` file 4. Run ```npm install``` 5. Run ```npm run build``` (this bundles `assets/` into `dist/`) -6. Run ```node app.js``` to boot the system (may need sudo!) +6. Run ```node main.js``` to boot the system (may need sudo!) (There's also ```install.sh``` and ```start.sh```, but they may not work for your OS.) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index bd401ad..347473b 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,3 +1,6 @@ +**5.1.2** *(Apr 22 2020)* +- Fixes the historical graph overflowing the maximum graphDuration value. + **5.1.1** *(Apr 21 2020)* - Fixes records being overwritten after boot. This bug did not corrupt saves and is only a visual error. diff --git a/lib/servers.js b/lib/servers.js index 0ad6dd6..919be31 100644 --- a/lib/servers.js +++ b/lib/servers.js @@ -171,13 +171,8 @@ class ServerRegistration { this._lastGraphDataPush = timestamp // Trim old graphPoints according to graphDuration - for (let i = 1; i < this.graphData.length; i++) { - // Find a break point where i - 1 is too old and i is new - if (timestamp - this.graphData[i - 1][0] > config.graphDuration && timestamp - this.graphData[i] <= config.graphDuration) { - this.graphData.splice(0, i) - break - } - } + const filterTimestamp = new Date().getTime() - config.graphDuration + this.graphData = this.graphData.filter(point => point[0] >= filterTimestamp) return true } diff --git a/package-lock.json b/package-lock.json index 9a497ae..08f317a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "minetrack", - "version": "5.1.0", + "version": "5.1.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 4cb1c85..df644e5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "minetrack", - "version": "5.1.1", + "version": "5.1.2", "description": "A Minecraft server tracker that lets you focus on the basics.", "main": "main.js", "dependencies": {