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:
@@ -359,7 +359,7 @@ export function loadJSON(
|
||||
dataFiles: Array<DataFile>,
|
||||
dataDir: string
|
||||
): Array<QuestionDb> {
|
||||
return dataFiles.reduce((acc, dataFile, index) => {
|
||||
const res: Array<QuestionDb> = dataFiles.reduce((acc, dataFile, index) => {
|
||||
const dataPath = dataDir + dataFile.path
|
||||
|
||||
if (!utils.FileExists(dataPath)) {
|
||||
@@ -382,6 +382,21 @@ export function loadJSON(
|
||||
}
|
||||
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 {
|
||||
|
Reference in New Issue
Block a user