mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Server stat fixes
This commit is contained in:
@@ -29,9 +29,12 @@ const coloredWords = {
|
|||||||
'possibleAnswers',
|
'possibleAnswers',
|
||||||
'irc',
|
'irc',
|
||||||
'faq',
|
'faq',
|
||||||
'/script'
|
'/script',
|
||||||
|
'listUserDir',
|
||||||
|
'forumEntries',
|
||||||
|
'contacts.json',
|
||||||
],
|
],
|
||||||
blue: ['isadding', 'ask'],
|
blue: ['isadding', 'ask', 'newUserDir', 'updateQuestion', 'uploadUserFile'],
|
||||||
magenta: [
|
magenta: [
|
||||||
'addPost',
|
'addPost',
|
||||||
'tiszai',
|
'tiszai',
|
||||||
@@ -60,7 +63,8 @@ const filterFromDailyStats = [
|
|||||||
'/f/',
|
'/f/',
|
||||||
'.git',
|
'.git',
|
||||||
'apple-touch-icon',
|
'apple-touch-icon',
|
||||||
'/.env'
|
'/.env',
|
||||||
|
'/userFiles/'
|
||||||
]
|
]
|
||||||
|
|
||||||
// -----------------------------------------------------------------
|
// -----------------------------------------------------------------
|
||||||
@@ -176,19 +180,22 @@ function getLetterNTimes(letter, number) {
|
|||||||
function pCols(cols, rowTitles, colorNames, firstRowColor, showDiff) {
|
function pCols(cols, rowTitles, colorNames, firstRowColor, showDiff) {
|
||||||
// console.log(cols)
|
// console.log(cols)
|
||||||
let maxLength = 0
|
let maxLength = 0
|
||||||
Object.keys(cols).forEach((key) => {
|
cols.forEach((col) => {
|
||||||
if (cols[key].length > maxLength) {
|
if (col.length > maxLength) {
|
||||||
maxLength = cols[key].length
|
maxLength = col.length
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
cols.reverse()
|
||||||
|
|
||||||
for (let i = 0; i < maxLength; i++) {
|
for (let i = 0; i < maxLength; i++) {
|
||||||
const row = []
|
const row = []
|
||||||
const lastItems = []
|
const lastItems = []
|
||||||
Object.keys(cols)
|
|
||||||
.reverse()
|
cols
|
||||||
.forEach((key) => {
|
.forEach((val) => {
|
||||||
const val = cols[key]
|
|
||||||
if (!val[i]) {
|
if (!val[i]) {
|
||||||
|
row.push(getLetterNTimes(' ', maxStatLength + 5))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,11 +284,34 @@ function preProcessDailyStats(obj) {
|
|||||||
return key.toLowerCase().includes(keyword.toLowerCase())
|
return key.toLowerCase().includes(keyword.toLowerCase())
|
||||||
})
|
})
|
||||||
if (!includes) {
|
if (!includes) {
|
||||||
acc.push({ name: key, val: obj[key] })
|
acc.push({ name: key.replace(/\.html/g, ''), val: obj[key] })
|
||||||
}
|
}
|
||||||
return acc
|
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) {
|
if (a.name > b.name) {
|
||||||
return 1
|
return 1
|
||||||
} else if (a.name < b.name) {
|
} else if (a.name < b.name) {
|
||||||
|
Submodule submodules/qmining-page updated: c16015a339...5d233f549d
Reference in New Issue
Block a user