Fix role aggregate
This commit is contained in:
parent
9577598783
commit
01ca3abeb9
1 changed files with 6 additions and 9 deletions
|
@ -132,17 +132,14 @@ impl DataSource for CGGDataSource {
|
||||||
let mut champions: IndexMap<String, Vec<String>> = IndexMap::new();
|
let mut champions: IndexMap<String, Vec<String>> = IndexMap::new();
|
||||||
for champ in &datas.lol.champions_report {
|
for champ in &datas.lol.champions_report {
|
||||||
let id = champ.champion_id.to_string();
|
let id = champ.champion_id.to_string();
|
||||||
let mut roles: Vec<String> = Vec::new();
|
|
||||||
|
|
||||||
if champions.contains_key(&id) {
|
if champions.contains_key(&id) {
|
||||||
let c = champions.get(&id).unwrap();
|
let mut roles = champions.get(&id).unwrap().clone();
|
||||||
let mut new_roles = c.clone();
|
|
||||||
new_roles.push(champ.role.clone());
|
|
||||||
} else {
|
|
||||||
roles.push(champ.role.clone());
|
roles.push(champ.role.clone());
|
||||||
}
|
champions.insert(id, roles);
|
||||||
|
} else {
|
||||||
champions.insert(id, roles);
|
champions.insert(id, [champ.role.clone()].to_vec());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for report in datas.lol.champions_report {
|
for report in datas.lol.champions_report {
|
||||||
|
|
Loading…
Add table
Reference in a new issue