This commit is contained in:
parent
b8b6d78951
commit
0c83809911
@ -103,13 +103,22 @@ impl DataSource for CGGDataSource {
|
||||
let datas: BuildResponse =
|
||||
serde_json::from_str(&RE.captures(&req.into_string().unwrap()).unwrap()[1].replace("undefined", "null")).unwrap();
|
||||
|
||||
let patch = String::from(datas.lol.champions_report[0].patch.as_str());
|
||||
let patch = datas.lol.champions_report[0].patch.clone();
|
||||
|
||||
let mut champions = IndexMap::new();
|
||||
let mut champions: IndexMap<String, Vec<String>> = IndexMap::new();
|
||||
for champ in &datas.lol.champions_report {
|
||||
let id = champ.champion_id.to_string();
|
||||
let positions = [String::from(&champ.role)].to_vec();
|
||||
champions.insert(id, positions);
|
||||
let mut roles: Vec<String> = Vec::new();
|
||||
|
||||
if champions.contains_key(&id) {
|
||||
let c = champions.get(&id).unwrap();
|
||||
let mut new_roles = c.clone();
|
||||
new_roles.push(champ.role.clone());
|
||||
} else {
|
||||
roles.push(champ.role.clone());
|
||||
}
|
||||
|
||||
champions.insert(id, roles);
|
||||
}
|
||||
|
||||
unsafe {
|
||||
|
Loading…
Reference in New Issue
Block a user