Fixes of invalid merging

This commit is contained in:
YourFriendlyNeighborhoodDealer 2018-12-22 12:05:16 +01:00
parent e6cc17ebb9
commit 8be69d39a5
2 changed files with 4 additions and 13 deletions

View file

@ -84,7 +84,7 @@ function AddVisitStat(name) {
("0" + (m.getMonth() + 1)).slice(-2) + "/" + ("0" + (m.getMonth() + 1)).slice(-2) + "/" +
("0" + m.getDate()).slice(-2); ("0" + m.getDate()).slice(-2);
if (vData[now] == undefined) if (vData[now] == undefined)
vData[now] = []; vData[now] = {};
if (vData[now][name] == undefined) if (vData[now][name] == undefined)
vData[now][name] = 0; vData[now][name] = 0;
vData[now][name]++; vData[now][name]++;

View file

@ -14,10 +14,10 @@ var fs = require('fs');
var logger = require('./logger.js'); var logger = require('./logger.js');
const recievedFile = "stats/recieved"; const recievedFile = "stats/recieved";
const publicFile = "public/data/public";
const staticFile = "public/data/static"; const staticFile = "public/data/static";
const manFile = "public/man.html"; const manFile = "public/man.html";
const logFile = "stats/logs"; const logFile = "stats/logs";
const dataFile = "public/data.json";
function ReadFile(name) { function ReadFile(name) {
if (!FileExists(name)) if (!FileExists(name))
@ -80,18 +80,9 @@ function Beep() {
function WriteBackup() { function WriteBackup() {
try { try {
WriteFileAsync(ReadFile(recievedFile), 'public/backs/recieved_' + new Date().toString()); WriteFileAsync(ReadFile(dataFile), 'public/backs/data_' + new Date().toString());
//logger.Log('[SAVE]: New questions backup wrote');
} catch (e) { } catch (e) {
logger.Log("[ERR ]: Error backing up recieved file!", logger.GetColor("redbg")); logger.Log("[ERR ]: Error backing up data json 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);
console.log(e); console.log(e);
} }
} }