diff --git a/src/kb_data_source.rs b/src/kb_data_source.rs index f97234a..c0af61e 100644 --- a/src/kb_data_source.rs +++ b/src/kb_data_source.rs @@ -74,8 +74,9 @@ struct KBBuild { start_item5: KBItem, #[serde(rename = "skillOrder")] skill_order: String, - wins: f64, + wins: u32, games: u32, + kda: f32, summoner: Summoner, patch: Patch, } @@ -278,9 +279,9 @@ impl KBDataSource { build.position.to_owned().to_uppercase(), blocks, Stat { - win_rate: (build.wins / build.games as f64) * 100., + win_rate: (build.wins as f32 / build.games as f32) * 100f32, games: build.games, - kda: 0.0, + kda: build.kda, patch: build.patch.patch_version.to_owned(), }, ) @@ -325,7 +326,7 @@ impl DataSource for KBDataSource { let data: BuildResponse = match client .get(&format!( "https://api.koreanbuilds.net/builds?chmpname={}&patchid=-2&position=COMPOSITE", - champ.id + champ.name )) .set("Accept", "application/json") .set("Authorization", token.as_str()) @@ -343,18 +344,12 @@ impl DataSource for KBDataSource { }; for pos in position { - let mut build: Option<&KBBuild> = None; - for b in &data.builds2 { if b.position.to_uppercase() == *pos { - build = Some(b); + champ_data.push(self.get_build(b)); break; } } - - if let Some(b) = build { - champ_data.push(self.get_build(b)); - } } } champ_data