oops format
Some checks reported errors
continuous-integration/drone/push Build was killed

This commit is contained in:
nyyu 2021-03-16 20:25:14 +01:00
parent 245e9c8628
commit bdf6f97923

View file

@ -15,7 +15,7 @@ struct ChampionResponse {
#[derive(Deserialize, Debug)]
struct Champion {
key: String,
name: String
name: String,
}
impl DataSource for PBDataSource {
@ -29,19 +29,18 @@ impl DataSource for PBDataSource {
300
}
fn get_champs_with_positions(
&self,
client: &ureq::Agent,
) -> IndexMap<u32, Vec<String>> {
fn get_champs_with_positions(&self, client: &ureq::Agent) -> IndexMap<u32, Vec<String>> {
let mut champs = IndexMap::new();
let page = client
.get("https://www.probuilds.net/ajax/championListNew")
.set("Accept", "application/json")
.call().unwrap().into_string().unwrap();
.get("https://www.probuilds.net/ajax/championListNew")
.set("Accept", "application/json")
.call()
.unwrap()
.into_string()
.unwrap();
let data: ChampionResponse =
serde_json::from_str(&page).unwrap();
let data: ChampionResponse = serde_json::from_str(&page).unwrap();
for champ in data.champions {
champs.insert(champ.key.parse::<u32>().unwrap(), vec!["ANY".to_owned()]);
@ -56,7 +55,6 @@ impl DataSource for PBDataSource {
positions: &[String],
client: &ureq::Agent,
) -> Vec<(String, Vec<Value>, Stat)> {
let mut builds = vec![];
let page = client
@ -68,10 +66,10 @@ impl DataSource for PBDataSource {
let mut build = &page[page.find("'items'").unwrap()..];
while build.contains("items") {
let pos = build.find("data-id=").unwrap();
build = &build[pos+10..];
build = &build[pos + 10..];
let end = build.find('\\').unwrap();
items.push(&build[..end]);
build = &build[pos+22..];
build = &build[pos + 22..];
}
builds.push((positions[0].to_owned(), vec![json!({
@ -79,7 +77,6 @@ impl DataSource for PBDataSource {
"type": "Set"
})], Stat{win_rate:0.0,games:1,kda:0.0,patch:"".to_string()}));
builds
}
}