diff --git a/scripts/serverStats.js b/scripts/serverStats.js index 589fa6f..dded9cf 100644 --- a/scripts/serverStats.js +++ b/scripts/serverStats.js @@ -29,9 +29,12 @@ const coloredWords = { 'possibleAnswers', 'irc', 'faq', - '/script' + '/script', + 'listUserDir', + 'forumEntries', + 'contacts.json', ], - blue: ['isadding', 'ask'], + blue: ['isadding', 'ask', 'newUserDir', 'updateQuestion', 'uploadUserFile'], magenta: [ 'addPost', 'tiszai', @@ -60,7 +63,8 @@ const filterFromDailyStats = [ '/f/', '.git', 'apple-touch-icon', - '/.env' + '/.env', + '/userFiles/' ] // ----------------------------------------------------------------- @@ -176,19 +180,22 @@ function getLetterNTimes(letter, number) { function pCols(cols, rowTitles, colorNames, firstRowColor, showDiff) { // console.log(cols) let maxLength = 0 - Object.keys(cols).forEach((key) => { - if (cols[key].length > maxLength) { - maxLength = cols[key].length + cols.forEach((col) => { + if (col.length > maxLength) { + maxLength = col.length } }) + + cols.reverse() + for (let i = 0; i < maxLength; i++) { const row = [] const lastItems = [] - Object.keys(cols) - .reverse() - .forEach((key) => { - const val = cols[key] + + cols + .forEach((val) => { if (!val[i]) { + row.push(getLetterNTimes(' ', maxStatLength + 5)) return } @@ -277,11 +284,34 @@ function preProcessDailyStats(obj) { return key.toLowerCase().includes(keyword.toLowerCase()) }) if (!includes) { - acc.push({ name: key, val: obj[key] }) + acc.push({ name: key.replace(/\.html/g, ''), val: obj[key] }) } return acc }, []) - return formatted.sort((a, b) => { + + const merged = formatted.reduce((acc, x) => { + const index = acc.findIndex((y) => { + return x.name === y.name + }) + + if (index !== -1) { + acc = acc.map((z, i) => { + if (i === index) { + return { + ...x, + val: z.val + x.val + } + } + return z + }) + } else { + acc.push(x) + } + + return acc + }, []) + + return merged.sort((a, b) => { if (a.name > b.name) { return 1 } else if (a.name < b.name) { diff --git a/submodules/qmining-page b/submodules/qmining-page index c16015a..5d233f5 160000 --- a/submodules/qmining-page +++ b/submodules/qmining-page @@ -1 +1 @@ -Subproject commit c16015a3399593424b4dce4552f571d8a6dae180 +Subproject commit 5d233f549dbaf3dd608481b3dddda67e41d4bea0