summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/bucky.js15
-rw-r--r--lib/index.js2
2 files changed, 6 insertions, 11 deletions
diff --git a/lib/bucky.js b/lib/bucky.js
index dddbae9..2488c31 100644
--- a/lib/bucky.js
+++ b/lib/bucky.js
@@ -23,17 +23,12 @@ var bucky = module.exports = {
ensureFileCountsForThreads: function (req, res, next){
db.getFileCounts(res.threads_ids).then(function(counts){
var lookup = {}
- counts.forEach(function(c,i){
- res.threads.at(i).set("file_count", c.count)
+ counts.forEach(function(c){
+ lookup[c.thread] = c
})
- next()
- })
- },
- ensureFileSizeForThreads: function (req, res, next){
- db.getFileSizes(res.threads_ids).then(function(sizes){
- var lookup = {}
- sizes.forEach(function(c,i){
- res.threads.at(i).set("file_size", c.size)
+ res.threads.forEach(function(t){
+ var c = lookup[t.id]
+ t.set("file_count", c ? c.count : 0)
})
next()
})
diff --git a/lib/index.js b/lib/index.js
index 2ccf812..e84c32a 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -87,7 +87,7 @@ site.route = function(){
bucky.ensureLatestThreads,
bucky.ensureCommentCountsForThreads,
bucky.ensureFileCountsForThreads,
- bucky.ensureFileSizeForThreads,
+// bucky.ensureFileSizeForThreads,
bucky.ensureHootbox,
function(req, res){
res.json({