Skip to content

Commit 060c549

Browse files
committed
feat(heartbeats): In score table show score percentages too
1 parent 4b8633c commit 060c549

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tools/heartbeats-processor/src/local_db.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -716,15 +716,22 @@ pub async fn view_scores(pool: &SqlitePool, config: &Config) -> Result<()> {
716716
println!("\nSubmitter Scores:");
717717
println!("--------------------------------------------------------");
718718
println!(
719-
"Public Key | Score | Blocks | Current Max | Total Max | Last Updated | Last Heartbeat"
719+
"Public Key | Score | Score % | Blocks | Current Max | Total Max | Last Updated | Last Heartbeat"
720720
);
721721
println!("--------------------------------------------------------");
722722

723723
for row in scores {
724+
let percentage = if max_scores.current > 0 {
725+
(row.score as f64 / max_scores.current as f64) * 100.0
726+
} else {
727+
0.0
728+
};
729+
724730
println!(
725-
"{:<40} | {:>5} | {:>6} | {:>11} | {:>9} | {} | {}",
731+
"{:<40} | {:>5} | {:>6.2}% | {:>6} | {:>11} | {:>9} | {} | {}",
726732
row.public_key,
727733
row.score,
734+
percentage,
728735
row.blocks_produced,
729736
max_scores.current,
730737
max_scores.total,

0 commit comments

Comments
 (0)