summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-01-08 15:30:26 +0100
committerJules Laplace <julescarbon@gmail.com>2018-01-08 15:30:26 +0100
commit5236a7e242a239b53baf600c0843c7e9339343b9 (patch)
treec007ec204c63a714632c609adf5aefd029876ced
parent10256ddf3b7d65fde443b68d305101c8e7edd5e4 (diff)
fetch thread file sizes correctly
-rw-r--r--bucky/app/bucky.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/bucky/app/bucky.js b/bucky/app/bucky.js
index 940e02d..0581bc9 100644
--- a/bucky/app/bucky.js
+++ b/bucky/app/bucky.js
@@ -30,7 +30,7 @@ var bucky = module.exports = {
})
},
ensureFileCountsForThreads: function (req, res, next){
- db.getFileCounts(res.threads_ids).then(function(counts){
+ db.getFileSizes(res.threads_ids).then(function(counts){
var lookup = {}
counts.forEach(function(c){
lookup[c.thread] = c
@@ -38,6 +38,7 @@ var bucky = module.exports = {
res.threads.forEach(function(t){
var c = lookup[t.id]
t.set("file_count", c ? c.count : 0)
+ t.set("size", c ? c.size : 0)
})
next()
})