From 9320883f92a9da19277209f9139ef22699cf01ea Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Sat, 6 Jul 2013 22:21:30 -0400 Subject: [PATCH] fixed live tiles if there are more than 2 posts --- src/categories.js | 2 +- src/webserver.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/categories.js b/src/categories.js index fb5cdeac12..1ff42a7304 100644 --- a/src/categories.js +++ b/src/categories.js @@ -277,7 +277,7 @@ var RDB = require('./redis.js'), } Categories.getRecentReplies = function(cid, count, callback) { - RDB.zrevrange('categories:recent_posts:cid:' + cid, 0, count, function(err, pids) { + RDB.zrevrange('categories:recent_posts:cid:' + cid, 0, count-1, function(err, pids) { if (pids.length == 0) { callback([]); diff --git a/src/webserver.js b/src/webserver.js index 1c57b732d0..e6a346944a 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -192,7 +192,7 @@ var express = require('express'), function iterator(category, callback) { categories.getRecentReplies(category.cid, 2, function(posts) { category["posts"] = posts; - category["post_count"] = posts.length; + category["post_count"] = posts.length>2 ? 2 : posts.length; callback(null); }); }