aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-05-05 13:47:51 +0200
committerChocobozzz <me@florianbigard.com>2022-05-05 13:47:51 +0200
commitf18a060a83d7053897173b2a24fb7984893131c7 (patch)
tree3480abf42239258d379166740f142a3cc0cb361a /server/models
parentb2d03a83315e52d32c6f4a92cad9cd682470099c (diff)
downloadPeerTube-f18a060a83d7053897173b2a24fb7984893131c7.tar.gz
PeerTube-f18a060a83d7053897173b2a24fb7984893131c7.tar.zst
PeerTube-f18a060a83d7053897173b2a24fb7984893131c7.zip
Remove comments, rates and views from stats
It prevent us to apply date filters
Diffstat (limited to 'server/models')
-rw-r--r--server/models/view/local-video-viewer.ts14
1 files changed, 1 insertions, 13 deletions
diff --git a/server/models/view/local-video-viewer.ts b/server/models/view/local-video-viewer.ts
index b6ddcbb57..5928ba5f6 100644
--- a/server/models/view/local-video-viewer.ts
+++ b/server/models/view/local-video-viewer.ts
@@ -134,9 +134,6 @@ export class LocalVideoViewerModel extends Model<Partial<AttributesOnly<LocalVid
134 FETCH FIRST 1 ROW ONLY` 134 FETCH FIRST 1 ROW ONLY`
135 const watchPeakPromise = LocalVideoViewerModel.sequelize.query<any>(watchPeakQuery, options) 135 const watchPeakPromise = LocalVideoViewerModel.sequelize.query<any>(watchPeakQuery, options)
136 136
137 const commentsQuery = `SELECT COUNT(*) AS comments FROM "videoComment" WHERE "videoId" = :videoId`
138 const commentsPromise = LocalVideoViewerModel.sequelize.query<any>(commentsQuery, options)
139
140 const countriesQuery = `SELECT country, COUNT(country) as viewers ` + 137 const countriesQuery = `SELECT country, COUNT(country) as viewers ` +
141 `FROM "localVideoViewer" ` + 138 `FROM "localVideoViewer" ` +
142 `WHERE "videoId" = :videoId AND country IS NOT NULL ` + 139 `WHERE "videoId" = :videoId AND country IS NOT NULL ` +
@@ -144,10 +141,9 @@ export class LocalVideoViewerModel extends Model<Partial<AttributesOnly<LocalVid
144 `ORDER BY viewers DESC` 141 `ORDER BY viewers DESC`
145 const countriesPromise = LocalVideoViewerModel.sequelize.query<any>(countriesQuery, options) 142 const countriesPromise = LocalVideoViewerModel.sequelize.query<any>(countriesQuery, options)
146 143
147 const [ rowsWatchTime, rowsWatchPeak, rowsComment, rowsCountries ] = await Promise.all([ 144 const [ rowsWatchTime, rowsWatchPeak, rowsCountries ] = await Promise.all([
148 watchTimePromise, 145 watchTimePromise,
149 watchPeakPromise, 146 watchPeakPromise,
150 commentsPromise,
151 countriesPromise 147 countriesPromise
152 ]) 148 ])
153 149
@@ -166,14 +162,6 @@ export class LocalVideoViewerModel extends Model<Partial<AttributesOnly<LocalVid
166 ? rowsWatchPeak[0].dateBreakpoint || null 162 ? rowsWatchPeak[0].dateBreakpoint || null
167 : null, 163 : null,
168 164
169 views: video.views,
170 likes: video.likes,
171 dislikes: video.dislikes,
172
173 comments: rowsComment.length !== 0
174 ? parseInt(rowsComment[0].comments) || 0
175 : 0,
176
177 countries: rowsCountries.map(r => ({ 165 countries: rowsCountries.map(r => ({
178 isoCode: r.country, 166 isoCode: r.country,
179 viewers: r.viewers 167 viewers: r.viewers