Browse Source

Fixed multi_response !rank

master
Brandon Cornejo 11 years ago
parent
commit
099f9ec5e6
  1. 7
      lib/currency.js

7
lib/currency.js

@ -560,11 +560,11 @@ Currency.prototype.query_rank = function(data, callback) {
var inner_sql = '', sql = 'set @row_number:=0;'; var inner_sql = '', sql = 'set @row_number:=0;';
data.forEach(function(user) { data.forEach(function(user) {
inner_sql += "user='"+user+"' or";
inner_sql += "user='"+user+"' or ";
}); });
// remove last 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;"; 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) { __self.db.execute(sql, function(rows) {
@ -573,6 +573,9 @@ Currency.prototype.query_rank = function(data, callback) {
callback(ranks, total); callback(ranks, total);
}); });
var file = require('fs');
file.appendFile('./../logs/error-log.txt', sql+'\n', function(d){});
}; };
Currency.prototype.query_top = function (data, callback) { Currency.prototype.query_top = function (data, callback) {

Loading…
Cancel
Save