From 8be69d39a51fdf88daf28779e564a137fa33c609 Mon Sep 17 00:00:00 2001 From: YourFriendlyNeighborhoodDealer <3167982-YourFriendlyNeighborhoodDealer@users.noreply.gitlab.com> Date: Sat, 22 Dec 2018 12:05:16 +0100 Subject: [PATCH] Fixes of invalid merging --- stat.js | 2 +- utils.js | 15 +++------------ 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/stat.js b/stat.js index 4b5bfa5..8ced883 100755 --- a/stat.js +++ b/stat.js @@ -84,7 +84,7 @@ function AddVisitStat(name) { ("0" + (m.getMonth() + 1)).slice(-2) + "/" + ("0" + m.getDate()).slice(-2); if (vData[now] == undefined) - vData[now] = []; + vData[now] = {}; if (vData[now][name] == undefined) vData[now][name] = 0; vData[now][name]++; diff --git a/utils.js b/utils.js index 1ae817e..8626af3 100644 --- a/utils.js +++ b/utils.js @@ -14,10 +14,10 @@ var fs = require('fs'); var logger = require('./logger.js'); const recievedFile = "stats/recieved"; -const publicFile = "public/data/public"; const staticFile = "public/data/static"; const manFile = "public/man.html"; const logFile = "stats/logs"; +const dataFile = "public/data.json"; function ReadFile(name) { if (!FileExists(name)) @@ -80,18 +80,9 @@ function Beep() { function WriteBackup() { try { - WriteFileAsync(ReadFile(recievedFile), 'public/backs/recieved_' + new Date().toString()); - //logger.Log('[SAVE]: New questions backup wrote'); - + WriteFileAsync(ReadFile(dataFile), 'public/backs/data_' + new Date().toString()); } catch (e) { - logger.Log("[ERR ]: Error backing up recieved file!", logger.GetColor("redbg")); - console.log(e); - } - try { - WriteFileAsync(ReadFile(publicFile), 'public/backs/public_' + new Date().toString()); - //logger.Log('[SAVE]: Public questions backup wrote'); - } catch (e) { - logger.Log("[ERR ]: Error backing up public file!", logger.GetColor("redbg"), true); + logger.Log("[ERR ]: Error backing up data json file!", logger.GetColor("redbg")); console.log(e); } }