Subjinfo fix

This commit is contained in:
mrfry 2020-10-05 15:37:14 +02:00
parent 3ed66f43b4
commit a0029d1998

View file

@ -824,9 +824,9 @@ function GetApp() {
function getSimplreRes() { function getSimplreRes() {
return { return {
subjects: data.length, subjects: data.Subjects.length,
questions: data.reduce((acc, subj) => { questions: data.Subjects.reduce((acc, subj) => {
return acc + subj.length return acc + subj.Questions.length
}, 0), }, 0),
} }
} }
@ -834,7 +834,7 @@ function GetApp() {
return data.map((subj) => { return data.map((subj) => {
return { return {
name: subj.Name, name: subj.Name,
count: subj.length, count: subj.Questions.length,
} }
}) })
} }
@ -887,8 +887,8 @@ function GetApp() {
utils.AppendToFile( utils.AppendToFile(
JSON.stringify({ JSON.stringify({
date: utils.GetDateString(), date: utils.GetDateString(),
subjectCount: data.length, subjectCount: data.Subjects.length,
questionCOunt: data.reduce((acc, subj) => { questionCount: data.Subjects.reduce((acc, subj) => {
return acc + subj.Questions.length return acc + subj.Questions.length
}, 0), }, 0),
userCount: dbtools.TableInfo(userDB, 'users').dataCount, userCount: dbtools.TableInfo(userDB, 'users').dataCount,