From 179914a2f28a8794d470c1f18c72d6ed00e8891e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Fri, 3 Sep 2021 01:23:35 +0300 Subject: [PATCH] Updated statisticsUpdate.js --- src/client/funcs/statisticsUpdate.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/client/funcs/statisticsUpdate.js b/src/client/funcs/statisticsUpdate.js index 2ca66c6..4fcf09c 100644 --- a/src/client/funcs/statisticsUpdate.js +++ b/src/client/funcs/statisticsUpdate.js @@ -2,21 +2,21 @@ module.exports = function statisticsUpdate(client, guild, radio) { client.datastore.checkEntry(guild.id); - radio.currentGuild = client.datastore.getEntry(guild.id); + radio.datastore = client.datastore.getEntry(guild.id); - if(!radio.currentGuild.statistics[radio.station.name]){ - radio.currentGuild.statistics[radio.station.name] = {}; - radio.currentGuild.statistics[radio.station.name].time = 0; - radio.currentGuild.statistics[radio.station.name].used = 0; - client.datastore.updateEntry(guild, radio.currentGuild); + if(!radio.datastore.statistics[radio.station.name]){ + radio.datastore.statistics[radio.station.name] = {}; + radio.datastore.statistics[radio.station.name].time = 0; + radio.datastore.statistics[radio.station.name].used = 0; + client.datastore.updateEntry(guild, radio.datastore); } let date = new Date(); radio.currentTime = date.getTime(); radio.playTime = parseInt(radio.currentTime)-parseInt(radio.startTime); - radio.currentGuild.statistics[radio.station.name].time = parseInt(radio.currentGuild.statistics[radio.station.name].time)+parseInt(radio.playTime); + radio.datastore.statistics[radio.station.name].time = parseInt(radio.datastore.statistics[radio.station.name].time)+parseInt(radio.playTime); - radio.currentGuild.statistics[radio.station.name].used = parseInt(radio.currentGuild.statistics[radio.station.name].used)+1; - client.datastore.updateEntry(guild, radio.currentGuild); + radio.datastore.statistics[radio.station.name].used = parseInt(radio.datastore.statistics[radio.station.name].used)+1; + client.datastore.updateEntry(guild, radio.datastore); client.datastore.calculateGlobal(client); } \ No newline at end of file