aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
Diffstat (limited to 'server/models')
-rw-r--r--server/models/view/local-video-viewer.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/server/models/view/local-video-viewer.ts b/server/models/view/local-video-viewer.ts
index b8c372040..12350861b 100644
--- a/server/models/view/local-video-viewer.ts
+++ b/server/models/view/local-video-viewer.ts
@@ -125,6 +125,7 @@ export class LocalVideoViewerModel extends Model<Partial<AttributesOnly<LocalVid
125 } 125 }
126 126
127 const watchTimeQuery = `SELECT ` + 127 const watchTimeQuery = `SELECT ` +
128 `COUNT("localVideoViewer"."id") AS "totalViewers", ` +
128 `SUM("localVideoViewer"."watchTime") AS "totalWatchTime", ` + 129 `SUM("localVideoViewer"."watchTime") AS "totalWatchTime", ` +
129 `AVG("localVideoViewer"."watchTime") AS "averageWatchTime" ` + 130 `AVG("localVideoViewer"."watchTime") AS "averageWatchTime" ` +
130 `FROM "localVideoViewer" ` + 131 `FROM "localVideoViewer" ` +
@@ -177,6 +178,10 @@ export class LocalVideoViewerModel extends Model<Partial<AttributesOnly<LocalVid
177 ? Math.round(rowsWatchTime[0].averageWatchTime) || 0 178 ? Math.round(rowsWatchTime[0].averageWatchTime) || 0
178 : 0, 179 : 0,
179 180
181 totalViewers: rowsWatchTime.length !== 0
182 ? Math.round(rowsWatchTime[0].totalViewers) || 0
183 : 0,
184
180 viewersPeak, 185 viewersPeak,
181 viewersPeakDate: rowsWatchPeak.length !== 0 && viewersPeak !== 0 186 viewersPeakDate: rowsWatchPeak.length !== 0 && viewersPeak !== 0
182 ? rowsWatchPeak[0].dateBreakpoint || null 187 ? rowsWatchPeak[0].dateBreakpoint || null