From 099f9ec5e630c45fe2e6db9318c775f0909331f0 Mon Sep 17 00:00:00 2001 From: Brandon Cornejo Date: Thu, 16 Jan 2014 22:34:44 -0600 Subject: [PATCH] Fixed multi_response !rank --- lib/currency.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/currency.js b/lib/currency.js index 58b113e..b70605a 100644 --- a/lib/currency.js +++ b/lib/currency.js @@ -560,11 +560,11 @@ Currency.prototype.query_rank = function(data, callback) { var inner_sql = '', sql = 'set @row_number:=0;'; data.forEach(function(user) { - inner_sql += "user='"+user+"' or"; + inner_sql += "user='"+user+"' or "; }); // remove last or - inner_sql=inner_sql.slice(0,-3); + inner_sql=inner_sql.slice(0,-4); sql += "select * from (select user, points, @row_number:=@row_number+1 from viewers order by points desc) as rank where ("+inner_sql+");select count(1) from viewers where points > 0;"; __self.db.execute(sql, function(rows) { @@ -573,6 +573,9 @@ Currency.prototype.query_rank = function(data, callback) { callback(ranks, total); }); + + var file = require('fs'); + file.appendFile('./../logs/error-log.txt', sql+'\n', function(d){}); }; Currency.prototype.query_top = function (data, callback) {