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:
parent
8730318741
commit
7e6ddd1e79
2 changed files with 43 additions and 13 deletions
|
@ -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) {
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit c16015a3399593424b4dce4552f571d8a6dae180
|
||||
Subproject commit 5d233f549dbaf3dd608481b3dddda67e41d4bea0
|
Loading…
Add table
Add a link
Reference in a new issue