mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 03:20:12 +08:00
fix: analytics modify
This commit is contained in:
1 parent
c243e29002
commit
9200336b49
5 files changed
+20
-16
No files matched your search
@@ -1,15 +1,15 @@
|
||||
import { userCount } from '../models/users.js'
|
||||
import { questCount, questCompleted } from '../models/profiles.js'
|
||||
import { totalQuests, totalCompleted } from '../models/profiles.js'
|
||||
|
||||
// eslint-disable-next-line import/prefer-default-export
|
||||
export async function homeController(req, res) {
|
||||
const payload = {
|
||||
title: 'Linux Odyssey Admin',
|
||||
userCount: await userCount(),
|
||||
questCount: await questCount(),
|
||||
questCompleted: await questCompleted(),
|
||||
totalQuests: await totalQuests(),
|
||||
totalCompleted: await totalCompleted(),
|
||||
}
|
||||
payload.completedRate =
|
||||
Math.round((payload.questCompleted / payload.questCount) * 10000) / 100
|
||||
Math.round((payload.totalCompleted / payload.totalQuests) * 10000) / 100
|
||||
res.render('home', payload)
|
||||
}
|
||||
Reference in new issue
Block a user