aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/pod.js
diff options
context:
space:
mode:
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 }