Fix users stats

This commit is contained in:
Chocobozzz 2022-06-17 16:16:28 +02:00
parent 82eb78504f
commit 5e0dbb3e52
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
4 changed files with 10 additions and 6 deletions

View File

@ -819,10 +819,10 @@ export class UserModel extends Model<Partial<AttributesOnly<UserModel>>> {
} }
} }
return UserModel.count(query) return UserModel.unscoped().count(query)
} }
const totalUsers = await UserModel.count() const totalUsers = await UserModel.unscoped().count()
const totalDailyActiveUsers = await getActiveUsers(1) const totalDailyActiveUsers = await getActiveUsers(1)
const totalWeeklyActiveUsers = await getActiveUsers(7) const totalWeeklyActiveUsers = await getActiveUsers(7)
const totalMonthlyActiveUsers = await getActiveUsers(30) const totalMonthlyActiveUsers = await getActiveUsers(30)

View File

@ -683,11 +683,11 @@ export class VideoCommentModel extends Model<Partial<AttributesOnly<VideoComment
const totalLocalVideoComments = await VideoCommentModel.count({ const totalLocalVideoComments = await VideoCommentModel.count({
include: [ include: [
{ {
model: AccountModel, model: AccountModel.unscoped(),
required: true, required: true,
include: [ include: [
{ {
model: ActorModel, model: ActorModel.unscoped(),
required: true, required: true,
where: { where: {
serverId: null serverId: null

View File

@ -617,11 +617,11 @@ export class VideoPlaylistModel extends Model<Partial<AttributesOnly<VideoPlayli
const totalLocalPlaylists = await VideoPlaylistModel.count({ const totalLocalPlaylists = await VideoPlaylistModel.count({
include: [ include: [
{ {
model: AccountModel, model: AccountModel.unscoped(),
required: true, required: true,
include: [ include: [
{ {
model: ActorModel, model: ActorModel.unscoped(),
required: true, required: true,
where: { where: {
serverId: null serverId: null

View File

@ -10,6 +10,8 @@ import {
doubleFollow, doubleFollow,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultAccountAvatar,
setDefaultChannelAvatar,
waitJobs waitJobs
} from '@shared/server-commands' } from '@shared/server-commands'
@ -29,6 +31,8 @@ describe('Test stats (excluding redundancy)', function () {
servers = await createMultipleServers(3) servers = await createMultipleServers(3)
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)
await setDefaultChannelAvatar(servers)
await setDefaultAccountAvatar(servers)
await doubleFollow(servers[0], servers[1]) await doubleFollow(servers[0], servers[1])