This commit is contained in:
parent
dd5faf3e96
commit
3f7de3abac
2 changed files with 12 additions and 14 deletions
|
@ -91,8 +91,7 @@ impl CGGDataSource {
|
|||
|
||||
fn extract_json(pattern: &str, page: &str) -> String {
|
||||
let json = page[page.find(pattern).unwrap() + pattern.len()..].to_owned();
|
||||
json[..json.find("};").unwrap() + 1]
|
||||
.replace("undefined", "null")
|
||||
json[..json.find("};").unwrap() + 1].replace("undefined", "null")
|
||||
}
|
||||
|
||||
impl DataSource for CGGDataSource {
|
||||
|
|
|
@ -241,9 +241,7 @@ impl DataSource for KBDataSource {
|
|||
}
|
||||
};
|
||||
let mut blocks = vec![];
|
||||
let mut winrate = 0.0;
|
||||
if !data.builds2.is_empty() {
|
||||
winrate = (data.builds2[0].wins / data.builds2[0].games) * 100.;
|
||||
let mut starting_items: Vec<Item> = vec![];
|
||||
if data.builds2[0].start_item0.item_id != 0 {
|
||||
starting_items.push(Item {
|
||||
|
@ -338,15 +336,16 @@ impl DataSource for KBDataSource {
|
|||
),
|
||||
items: final_items
|
||||
}));
|
||||
}
|
||||
Some((
|
||||
return Some((
|
||||
blocks,
|
||||
Stat {
|
||||
win_rate: winrate,
|
||||
win_rate: (data.builds2[0].wins / data.builds2[0].games) * 100.,
|
||||
games: data.builds2[0].games as u32,
|
||||
kda: 0.0,
|
||||
},
|
||||
))
|
||||
));
|
||||
}
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue