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