make getMaxGraphDataLength/getMaxServerGraphDataLength methods static
This commit is contained in:
12
lib/time.js
12
lib/time.js
@ -1,3 +1,5 @@
|
||||
const config = require('../config.json')
|
||||
|
||||
class TimeTracker {
|
||||
constructor (app) {
|
||||
this._app = app
|
||||
@ -9,7 +11,7 @@ class TimeTracker {
|
||||
|
||||
this._points.push(timestamp)
|
||||
|
||||
if (this._points.length > this._app.pingController.getMaxServerGraphDataLength()) {
|
||||
if (this._points.length > TimeTracker.getMaxServerGraphDataLength()) {
|
||||
this._points.shift()
|
||||
}
|
||||
|
||||
@ -19,6 +21,14 @@ class TimeTracker {
|
||||
getPoints () {
|
||||
return this._points
|
||||
}
|
||||
|
||||
static getMaxServerGraphDataLength () {
|
||||
return Math.ceil(config.serverGraphDuration / config.rates.pingAll)
|
||||
}
|
||||
|
||||
static getMaxGraphDataLength () {
|
||||
return Math.ceil(config.graphDuration / config.rates.pingAll)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = TimeTracker
|
||||
|
Reference in New Issue
Block a user