Round percentage value
This commit is contained in:
parent
1b92da1ab2
commit
8e6305d934
1 changed files with 1 additions and 1 deletions
|
@ -55,7 +55,7 @@ fn seconds_to_time(seconds: f64) -> String {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn time_to_percentage(total: f64, current: f64) -> String {
|
fn time_to_percentage(total: f64, current: f64) -> String {
|
||||||
let result = (100.0f64 * current / total).to_string();
|
let result = (100.0f64 * current / total).round().to_string();
|
||||||
match result.split_once('.') {
|
match result.split_once('.') {
|
||||||
Some((a, _)) => a.to_string() + "%",
|
Some((a, _)) => a.to_string() + "%",
|
||||||
None => result + "%",
|
None => result + "%",
|
||||||
|
|
Loading…
Reference in a new issue