1
0
Fork 0

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 totalWeeklyActiveUsers = await getActiveUsers(7)
const totalMonthlyActiveUsers = await getActiveUsers(30)

View file

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

View file

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

View file

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