fix: re-calculate completed rate in analytics

This commit is contained in:
Chen, Tai-Lin committed 2023-12-10 01:25:27 +08:00
1 parent b625abae68
commit c243e29002
3 files changed
+28 -8

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
/* eslint-disable object-shorthand */
/* eslint-disable func-names */
import { UserProfile } from '@linux-odyssey/models'
export function questCount() {
return UserProfile.find().count()
}
export function questCompleted() {
return UserProfile.find({
$where: function () {
for (const key in this.progress) {
if (this.progress[key].completed === true) {
return true
}
}
return false
},
}).count()
}