| |
let len = len as f64;
|
| |
|
| |
let lines = page_size + step.saturating_sub(page_size as usize) as f64;
|
| - |
let progress = (lines / len * 100_f64).ceil() as usize;
|
| + |
let progress = (lines / len * 100.0).ceil();
|
| |
|
| - |
if progress > 97 {
|
| - |
Self::map_range((0, progress), (0, 100), progress)
|
| + |
if progress > 97.0 {
|
| + |
Self::map_range((0.0, progress), (0.0, 100.0), progress) as usize
|
| |
} else {
|
| - |
progress
|
| + |
progress as usize
|
| |
}
|
| |
}
|
| |
|
| - |
fn map_range(from: (usize, usize), to: (usize, usize), value: usize) -> usize {
|
| + |
fn map_range(from: (f64, f64), to: (f64, f64), value: f64) -> f64 {
|
| |
to.0 + (value - from.0) * (to.1 - to.0) / (from.1 - from.0)
|
| |
}
|
| |
}
|