이재용

callback 으로 값 전달 및 승률 출력 형식 변경

const searchGameInfo = require('../api/api');
var result = {};
var urlencode=require("urlencode")
var urlencode=require("urlencode");
const search = require('../api/api');
var local_puuid;
result.userInfo = function(name) {
var need_data;
result.userInfo = function(name,callback) {
var encode_name=urlencode(name)
searchGameInfo.getPuuid(encode_name).then(puuid => {
local_puuid=puuid
......@@ -62,7 +63,7 @@ result.userInfo = function(name) {
}
var result={}
var result=[]
rest_dic=all_map_count
for (key in all_map_count)
{
......@@ -70,7 +71,9 @@ result.userInfo = function(name) {
{
if(key==key2)
{
console.log(key+" 승률: "+top_map_count[key]/all_map_count[key]+" 판 수: ("+top_map_count[key]+"/"+all_map_count[key]+")")
a=key+" 승률: "+(top_map_count[key]/all_map_count[key]).toFixed(3)+" 판 수: ("+top_map_count[key]+"/"+all_map_count[key]+")"
result.push(a)
delete rest_dic[key]
}
......@@ -78,10 +81,13 @@ result.userInfo = function(name) {
}
for (key in rest_dic)
{
console.log(key+" 승률: 0 판 수: (0/"+all_map_count[key]+")")
b=key+" 승률: 0 판 수: (0/"+all_map_count[key]+")"
result.push(b)
}
callback(result);
});
//res.end("done");
};
module.exports = result;
\ No newline at end of file
......