Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not use boxcar windowing when displaying the final total of the speed #381

Merged
merged 1 commit into from
Feb 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,15 @@ impl ProgressState {

/// The number of steps per second
pub(crate) fn per_sec(&self) -> f64 {
let per_sec = 1.0 / self.est.seconds_per_step();
if per_sec.is_nan() {
0.0
if matches!(&self.status, Status::InProgress) {
let per_sec = 1.0 / self.est.seconds_per_step();
if per_sec.is_nan() {
0.0
} else {
per_sec
}
} else {
per_sec
self.len as f64 / self.started.elapsed().as_secs_f64()
}
}

Expand Down