Skip to content

Commit

Permalink
feat(node-core): stage progress decimal places
Browse files Browse the repository at this point in the history
  • Loading branch information
shekhirin committed Mar 5, 2024
1 parent 96fcdfb commit 84f977c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crates/primitives/src/stage/checkpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,11 @@ impl EntitiesCheckpoint {
return None
}

Some(format!("{:.2}%", 100.0 * self.processed as f64 / self.total as f64))
// Calculate percentage with 2 decimal places.
let percentage = 100.0 * self.processed as f64 / self.total as f64;

// Truncate to 2 decimal places, rounding down so that 99.999% becomes 99.99% and not 100%.
Some(format!("{:.2}%", (percentage * 100.0).floor() / 100.0))
}
}

Expand Down

0 comments on commit 84f977c

Please sign in to comment.