Skip to content

Commit

Permalink
fix tests for active channel stats
Browse files Browse the repository at this point in the history
  • Loading branch information
rigelk committed Apr 8, 2021
1 parent eeeb43b commit b3148b6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions server/models/video/video-channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,11 @@ export class VideoChannelModel extends Model {
}

const query = `
SELECT Count(DISTINCT("VideoChannelModel"."id")) AS "count"
SELECT COUNT(DISTINCT("VideoChannelModel"."id")) AS "count"
FROM "videoChannel" AS "VideoChannelModel"
INNER JOIN "video" AS "Videos"
ON "VideoChannelModel"."id" = "Videos"."channelId"
AND ("Videos"."createdAt" > Now() - interval '${days}d')
AND ("Videos"."publishedAt" > Now() - interval '${days}d')
INNER JOIN "account" AS "Account"
ON "VideoChannelModel"."accountId" = "Account"."id"
INNER JOIN "actor" AS "Account->Actor"
Expand Down
7 changes: 3 additions & 4 deletions server/tests/api/server/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ describe('Test stats (excluding redundancy)', function () {
it('Should have the correct active channel stats', async function () {
const server = servers[0]
const videoChannelProperties = { name: 'second_channel', displayName: 'My second channel' }
let videoChannel

{
const res = await getStats(server.url)
Expand All @@ -155,7 +156,8 @@ describe('Test stats (excluding redundancy)', function () {
}

{
await addVideoChannel(server.url, server.accessToken, videoChannelProperties)
const resChannel = await addVideoChannel(server.url, server.accessToken, videoChannelProperties)
videoChannel = resChannel.body.videoChannel.id

const res = await getStats(server.url)
const data: ServerStats = res.body
Expand All @@ -165,9 +167,6 @@ describe('Test stats (excluding redundancy)', function () {
}

{
const resChannel = await getMyUserInformation(server.url, server.accessToken)
const videoChannel = server.videoChannel = resChannel.body.videoChannels.find(v => v.name === videoChannelProperties.name)

await uploadVideo(server.url, server.accessToken, { fixture: 'video_short.webm', channelId: videoChannel.id })

const res = await getStats(server.url)
Expand Down

0 comments on commit b3148b6

Please sign in to comment.