@@ -2070,8 +2070,11 @@ router.get('/firstwin', function (req, res) {
});
},
function(activity,callback){
varsql2=`select count(*) from battle_history where type ='athletic' and isfirstwin='t' and ( usernameA = '${username}' OR usernameB = '${username}' ) and start_time > '${activity.start}' and start_time < '${activity.end}'`
varsql2=`select count(*) from battle_history where type ='athletic' and isfirstwin='t' and ( (usernameA = '${username}' AND userscorea > userscoreb ) OR (usernameB = '${username}' AND userscoreb > userscorea) ) and start_time > '${activity.start}' and start_time < '${activity.end}' `
console.log(sql2)
client.query(sql2,function(err,result){
done()
...
...
@@ -2083,7 +2086,7 @@ router.get('/firstwin', function (req, res) {
function(activity,callback){
vartoday=moment().format('YYYY-MM-DD')
varsql2=`select count(*) from battle_history where type ='athletic' and isfirstwin='t' and ( usernameA = '${username}' OR usernameB = '${username}' ) and start_time > '${today}' `
varsql2=`select count(*) from battle_history where type ='athletic' and isfirstwin='t' and ( (usernameA = '${username}' AND userscorea > userscoreb ) OR (usernameB = '${username}' AND userscoreb > userscorea) ) and start_time > '${today}' `