From 7d38170ba6628fd8ce9fe68f525b1172dd23dbed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 16 Sep 2021 04:50:44 +0300 Subject: [PATCH] Removed calculateGlobal function in Datastore class --- src/client/classes/Datastore.js | 41 --------------------------------- 1 file changed, 41 deletions(-) diff --git a/src/client/classes/Datastore.js b/src/client/classes/Datastore.js index dfcd07d..d219b27 100644 --- a/src/client/classes/Datastore.js +++ b/src/client/classes/Datastore.js @@ -27,47 +27,6 @@ module.exports = class { //console.log(""); } - calculateGlobal(client){ - if(!client.stations) return; - - let guilds = this.map.keys(); - let stations = client.stations; - var statistics = {}; - - if(!client.stations) return; - - let calculation = guilds.next(); - - while (!calculation.done) { - let currentGuild = this.getEntry(calculation.value); - if(calculation.value != 'global'){ - if(stations){ - Object.keys(stations).forEach(function(station) { - if(currentGuild.statistics[stations[station].name] && currentGuild.statistics[stations[station].name].time && parseInt(currentGuild.statistics[stations[station].name].time) != 0 && currentGuild.statistics[stations[station].name].used && parseInt(currentGuild.statistics[stations[station].name].used) != 0){ - if(!statistics[stations[station].name]){ - statistics[stations[station].name] = {}; - statistics[stations[station].name].time = 0; - statistics[stations[station].name].used = 0; - } - - statistics[stations[station].name].time = parseInt(statistics[stations[station].name].time)+parseInt(currentGuild.statistics[stations[station].name].time); - statistics[stations[station].name].used = parseInt(statistics[stations[station].name].used)+parseInt(currentGuild.statistics[stations[station].name].used); - } - }); - } - } - calculation = guilds.next(); - } - - let newData = {}; - newData.guild = {}; - newData.guild.id = "global"; - newData.guild.name = "global"; - newData.statistics = statistics; - this.updateEntry(newData.guild, newData); - } - - checkEntry(id){ this.loadEntry(id); if(!this.map.has(id)){