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}'`
console.log(sql2)
client.query(sql2,function(err,result){
done()
activity.total=result.rows[0].count
callback(err,activity);
});
},
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}' `
console.log(sql2)
client.query(sql2,function(err,result){
done()
activity.today=result.rows[0].count
callback(err,activity);
});
},
],function(err,activity){
res.json(activity);
});
});
});
createUser=function(username,ep,epEventName){
pool.connect(function(err,client,done){
letsql=`insert into user_info (username) values ('${username}')`