kb: fix champ retrieve use name, add kda
This commit is contained in:
parent
d854da599f
commit
44410866fb
1 changed files with 6 additions and 11 deletions
|
@ -74,8 +74,9 @@ struct KBBuild {
|
||||||
start_item5: KBItem,
|
start_item5: KBItem,
|
||||||
#[serde(rename = "skillOrder")]
|
#[serde(rename = "skillOrder")]
|
||||||
skill_order: String,
|
skill_order: String,
|
||||||
wins: f64,
|
wins: u32,
|
||||||
games: u32,
|
games: u32,
|
||||||
|
kda: f32,
|
||||||
summoner: Summoner,
|
summoner: Summoner,
|
||||||
patch: Patch,
|
patch: Patch,
|
||||||
}
|
}
|
||||||
|
@ -278,9 +279,9 @@ impl KBDataSource {
|
||||||
build.position.to_owned().to_uppercase(),
|
build.position.to_owned().to_uppercase(),
|
||||||
blocks,
|
blocks,
|
||||||
Stat {
|
Stat {
|
||||||
win_rate: (build.wins / build.games as f64) * 100.,
|
win_rate: (build.wins as f32 / build.games as f32) * 100f32,
|
||||||
games: build.games,
|
games: build.games,
|
||||||
kda: 0.0,
|
kda: build.kda,
|
||||||
patch: build.patch.patch_version.to_owned(),
|
patch: build.patch.patch_version.to_owned(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -325,7 +326,7 @@ impl DataSource for KBDataSource {
|
||||||
let data: BuildResponse = match client
|
let data: BuildResponse = match client
|
||||||
.get(&format!(
|
.get(&format!(
|
||||||
"https://api.koreanbuilds.net/builds?chmpname={}&patchid=-2&position=COMPOSITE",
|
"https://api.koreanbuilds.net/builds?chmpname={}&patchid=-2&position=COMPOSITE",
|
||||||
champ.id
|
champ.name
|
||||||
))
|
))
|
||||||
.set("Accept", "application/json")
|
.set("Accept", "application/json")
|
||||||
.set("Authorization", token.as_str())
|
.set("Authorization", token.as_str())
|
||||||
|
@ -343,18 +344,12 @@ impl DataSource for KBDataSource {
|
||||||
};
|
};
|
||||||
|
|
||||||
for pos in position {
|
for pos in position {
|
||||||
let mut build: Option<&KBBuild> = None;
|
|
||||||
|
|
||||||
for b in &data.builds2 {
|
for b in &data.builds2 {
|
||||||
if b.position.to_uppercase() == *pos {
|
if b.position.to_uppercase() == *pos {
|
||||||
build = Some(b);
|
champ_data.push(self.get_build(b));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(b) = build {
|
|
||||||
champ_data.push(self.get_build(b));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
champ_data
|
champ_data
|
||||||
|
|
Loading…
Add table
Reference in a new issue