aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/pod.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-02-26 18:57:33 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-02-26 20:01:26 +0100
commite4c87ec26962e359d1c70b03ed188a3f19d6a25b (patch)
tree26fe20e6f600bc6f6f569dde2171b0a2346b135c /server/models/pod.js
parent9e167724f7e933f41d9ea2e1c31772bf4c560a28 (diff)
downloadPeerTube-e4c87ec26962e359d1c70b03ed188a3f19d6a25b.tar.gz
PeerTube-e4c87ec26962e359d1c70b03ed188a3f19d6a25b.tar.zst
PeerTube-e4c87ec26962e359d1c70b03ed188a3f19d6a25b.zip
Server: implement video views
Diffstat (limited to 'server/models/pod.js')
-rw-r--r--server/models/pod.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/server/models/pod.js b/server/models/pod.js
index 14814708e..8e2d488e1 100644
--- a/server/models/pod.js
+++ b/server/models/pod.js
@@ -148,7 +148,12 @@ function listAllIds (transaction, callback) {
148 }) 148 })
149} 149}
150 150
151function listRandomPodIdsWithRequest (limit, tableRequestPod, callback) { 151function listRandomPodIdsWithRequest (limit, tableWithPods, tableWithPodsJoins, callback) {
152 if (!callback) {
153 callback = tableWithPodsJoins
154 tableWithPodsJoins = ''
155 }
156
152 const self = this 157 const self = this
153 158
154 self.count().asCallback(function (err, count) { 159 self.count().asCallback(function (err, count) {
@@ -170,7 +175,7 @@ function listRandomPodIdsWithRequest (limit, tableRequestPod, callback) {
170 where: { 175 where: {
171 id: { 176 id: {
172 $in: [ 177 $in: [
173 this.sequelize.literal('SELECT "podId" FROM "' + tableRequestPod + '"') 178 this.sequelize.literal(`SELECT DISTINCT "${tableWithPods}"."podId" FROM "${tableWithPods}" ${tableWithPodsJoins}`)
174 ] 179 ]
175 } 180 }
176 } 181 }