Fixed api getinfos

This commit is contained in:
mrfry 2020-10-05 10:13:22 +02:00
parent 46ce575bb0
commit 13dea517d4

View file

@ -823,15 +823,16 @@ function GetApp() {
}) })
function getSimplreRes() { function getSimplreRes() {
console.log(data)
return { return {
subjects: data.length, subjects: data.length,
questions: data.Subjects.reduce((acc, subj) => { questions: data.reduce((acc, subj) => {
return acc + subj.length return acc + subj.length
}, 0), }, 0),
} }
} }
function getDetailedRes() { function getDetailedRes() {
return data.Subjects.map((subj) => { return data.map((subj) => {
return { return {
name: subj.Name, name: subj.Name,
count: subj.length, count: subj.length,
@ -887,8 +888,8 @@ function GetApp() {
utils.AppendToFile( utils.AppendToFile(
JSON.stringify({ JSON.stringify({
date: utils.GetDateString(), date: utils.GetDateString(),
subjectCount: data.Subjects.length, subjectCount: data.length,
questionCOunt: data.Subjects.reduce((acc, subj) => { questionCOunt: data.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,