mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-11-09 23:40:18 +00:00
Fixed calculateGlobal
This commit is contained in:
parent
b9ad745770
commit
d3f8aee812
@ -26,7 +26,7 @@ module.exports = class {
|
|||||||
calculateGlobal(client){
|
calculateGlobal(client){
|
||||||
let guilds = this.map.keys();
|
let guilds = this.map.keys();
|
||||||
let stations = client.stations;
|
let stations = client.stations;
|
||||||
let statistics = {};
|
var statistics = {};
|
||||||
|
|
||||||
if(!client.stations) return;
|
if(!client.stations) return;
|
||||||
|
|
||||||
@ -34,23 +34,21 @@ module.exports = class {
|
|||||||
|
|
||||||
while (!calculation.done) {
|
while (!calculation.done) {
|
||||||
let currentGuild = this.getEntry(calculation.value);
|
let currentGuild = this.getEntry(calculation.value);
|
||||||
if(calculation.value == 'global'){
|
if(calculation.value != 'global'){
|
||||||
return calculation = guilds.next();
|
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(stations){
|
if(!statistics[stations[station].name]){
|
||||||
Object.keys(stations).forEach(function(station) {
|
statistics[stations[station].name] = {};
|
||||||
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){
|
statistics[stations[station].name].time = 0;
|
||||||
if(!statistics[stations[station].name]){
|
statistics[stations[station].name].used = 0;
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
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();
|
calculation = guilds.next();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user