Toggle navigation
Toggle navigation
This project
Loading...
Sign in
이재용
/
TFT_My_Galaxy
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
이재용
2020-06-28 17:26:44 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
585719de5764951e1505ddedcfed5e3cb9476cbe
585719de
1 parent
e9babf75
api 로 가져온 데이터를 실제 사용하는 곳
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
87 additions
and
0 deletions
TFT_My_Galaxy/user/userinfo.js
TFT_My_Galaxy/user/userinfo.js
0 → 100644
View file @
585719d
const
searchGameInfo
=
require
(
'../api/api'
);
var
result
=
{};
var
urlencode
=
require
(
"urlencode"
)
var
local_puuid
;
result
.
userInfo
=
function
(
name
)
{
var
encode_name
=
urlencode
(
name
)
searchGameInfo
.
getPuuid
(
encode_name
).
then
(
puuid
=>
{
local_puuid
=
puuid
return
searchGameInfo
.
getGamename
(
puuid
);
}).
then
(
gamenames
=>
{
//console.log(gamenames);
async
function
loop
(
gamenames
)
{
let
gametraits
=
[]
for
(
var
game_name_Index
=
0
;
game_name_Index
<
gamenames
.
length
;
game_name_Index
++
){
await
searchGameInfo
.
getGametrait
(
gamenames
[
game_name_Index
]).
then
(
gametrait
=>
{
gametraits
.
push
(
gametrait
);
})
}
return
gametraits
;
}
return
loop
(
gamenames
);
}).
then
(
data
=>
{
var
top_game_map
=
[]
var
all_game_map
=
[]
for
(
var
data_index
=
0
;
data_index
<
data
.
length
;
data_index
++
)
{
for
(
var
participants_num
=
0
;
participants_num
<
8
;
participants_num
++
)
{
if
(
data
[
data_index
].
participants
[
participants_num
].
puuid
==
local_puuid
&&
data
[
data_index
].
participants
[
participants_num
].
placement
<=
4
)
{
top_game_map
.
push
(
data
[
data_index
].
game_variation
)
}
}
all_game_map
.
push
(
data
[
data_index
].
game_variation
)
}
var
all_map_count
=
{};
var
top_map_count
=
{};
for
(
var
i
=
0
;
i
<
all_game_map
.
length
;
++
i
)
{
if
(
!
all_map_count
[
all_game_map
[
i
]])
{
all_map_count
[
all_game_map
[
i
]]
=
0
;
}
++
all_map_count
[
all_game_map
[
i
]];
}
for
(
var
i
=
0
;
i
<
top_game_map
.
length
;
++
i
)
{
if
(
!
top_map_count
[
top_game_map
[
i
]])
{
top_map_count
[
top_game_map
[
i
]]
=
0
;
}
++
top_map_count
[
top_game_map
[
i
]];
}
var
result
=
{}
rest_dic
=
all_map_count
for
(
key
in
all_map_count
)
{
for
(
key2
in
top_map_count
)
{
if
(
key
==
key2
)
{
console
.
log
(
key
+
" 승률: "
+
top_map_count
[
key
]
/
all_map_count
[
key
]
+
" 판 수: ("
+
top_map_count
[
key
]
+
"/"
+
all_map_count
[
key
]
+
")"
)
delete
rest_dic
[
key
]
}
}
}
for
(
key
in
rest_dic
)
{
console
.
log
(
key
+
" 승률: 0 판 수: (0/"
+
all_map_count
[
key
]
+
")"
)
}
});
//res.end("done");
};
module
.
exports
=
result
;
\ No newline at end of file
Please
register
or
login
to post a comment