This commit is contained in:
AndrewTrieu
2023-03-12 12:43:33 +02:00
parent f14618b7cc
commit d6d09df845
11 changed files with 28 additions and 31 deletions

View File

@@ -2,15 +2,15 @@ import { countTopics } from "../../services/topicService.js";
import { countQuestions } from "../../services/questionService.js";
import { countAnswers } from "../../services/answerService.js";
const showMain = ({ render }) => {
const showMain = async ({ render }) => {
const statistics = {
totalTopics: 0,
totalQuestions: 0,
totalAnswers: 0,
totalTopics: "0",
totalQuestions: "0",
totalAnswers: "0",
};
statistics.totalTopics = countTopics();
statistics.totalQuestions = countQuestions();
statistics.totalAnswers = countAnswers();
statistics.totalTopics = await countTopics();
statistics.totalQuestions = await countQuestions();
statistics.totalAnswers = await countAnswers();
render("main.eta", statistics);
};