mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
logging subj/question count on server start
This commit is contained in:
parent
473b6d1b21
commit
01764754b0
1 changed files with 16 additions and 1 deletions
|
@ -359,7 +359,7 @@ export function loadJSON(
|
||||||
dataFiles: Array<DataFile>,
|
dataFiles: Array<DataFile>,
|
||||||
dataDir: string
|
dataDir: string
|
||||||
): Array<QuestionDb> {
|
): Array<QuestionDb> {
|
||||||
return dataFiles.reduce((acc, dataFile, index) => {
|
const res: Array<QuestionDb> = dataFiles.reduce((acc, dataFile, index) => {
|
||||||
const dataPath = dataDir + dataFile.path
|
const dataPath = dataDir + dataFile.path
|
||||||
|
|
||||||
if (!utils.FileExists(dataPath)) {
|
if (!utils.FileExists(dataPath)) {
|
||||||
|
@ -382,6 +382,21 @@ export function loadJSON(
|
||||||
}
|
}
|
||||||
return acc
|
return acc
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
let subjCount = 0
|
||||||
|
let questionCount = 0
|
||||||
|
res.forEach((qdb) => {
|
||||||
|
subjCount += qdb.data.length
|
||||||
|
qdb.data.forEach((subj) => {
|
||||||
|
questionCount += subj.Questions.length
|
||||||
|
})
|
||||||
|
})
|
||||||
|
logger.Log(
|
||||||
|
`Loaded ${subjCount} subjects with ${questionCount} questions from ${res.length} question db-s`,
|
||||||
|
logger.GetColor('green')
|
||||||
|
)
|
||||||
|
|
||||||
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
export function writeData(data: Array<Subject>, path: string): void {
|
export function writeData(data: Array<Subject>, path: string): void {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue