dont create term object on each call

This commit is contained in:
barisusakli
2014-09-03 15:16:41 -04:00
parent 9f0fff4434
commit 4736a68534
4 changed files with 84 additions and 76 deletions

View File

@@ -5,6 +5,12 @@
var db = require('./../database');
module.exports = function(Topics) {
var terms = {
day: 86400000,
week: 604800000,
month: 2592000000,
year: 31104000000
};
Topics.getLatestTopics = function(uid, start, end, term, callback) {
Topics.getLatestTids(start, end, term, function(err, tids) {
@@ -17,15 +23,8 @@ module.exports = function(Topics) {
};
Topics.getLatestTids = function(start, end, term, callback) {
var terms = {
day: 86400000,
week: 604800000,
month: 2592000000,
year: 31104000000
};
var since = terms.day;
if(terms[term]) {
if (terms[term]) {
since = terms[term];
}