Server stat fixes

This commit is contained in:
mrfry 2021-04-28 17:38:55 +02:00
parent c1197533c7
commit 194b05b13e

View file

@ -28,6 +28,8 @@ const coloredWords = {
'allqr', 'allqr',
'possibleAnswers', 'possibleAnswers',
'irc', 'irc',
'faq',
'/script'
], ],
blue: ['isadding', 'ask'], blue: ['isadding', 'ask'],
magenta: [ magenta: [
@ -158,7 +160,9 @@ function countLinesMatching(text, toMatch) {
} }
function readFile(name) { function readFile(name) {
return fs.readFileSync(name, 'utf8') if (fs.existsSync(name)) {
return fs.readFileSync(name, 'utf8')
}
} }
function getLetterNTimes(letter, number) { function getLetterNTimes(letter, number) {
@ -379,9 +383,9 @@ function printLastDataCount(data) {
} }
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
printHeader('Daily script install / update check count') printHeader('Daily script install / update check count')
const todaysLogs = readFile(`${dir}stats/vlogs/${getDayIndex()}`) const todaysLogs = readFile(`${dir}stats/vlogs/log`)
const yesterdaysLogs = readFile(`${dir}stats/vlogs/${getDayIndex(-1)}`) const yesterdaysLogs = readFile(`${dir}stats/vlogs/${getDayIndex(-1)}`) || ''
const beforeYesterdaysLogs = readFile(`${dir}stats/vlogs/${getDayIndex(-2)}`) const beforeYesterdaysLogs = readFile(`${dir}stats/vlogs/${getDayIndex(-2)}`) || ''
const installs = [ const installs = [
[ [