Skip to content

Commit

Permalink
Merge pull request #224 from peterablehmann/main
Browse files Browse the repository at this point in the history
Fix describe_node_list remaining nodes special case
  • Loading branch information
zhaofengli authored Oct 7, 2024
2 parents 0fca61a + 569c914 commit b0a62f2
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -874,11 +874,17 @@ fn describe_node_list(nodes: &[NodeName]) -> Option<String> {
}

let (idx, next) = next.unwrap();
let remaining = rough_limit - s.len();
let remaining_text = rough_limit - s.len();
let remaining_nodes = total - idx;

if next.len() + other_text.len() >= remaining {
write!(s, ", and {} other nodes", total - idx).unwrap();
break;
if next.len() + other_text.len() >= remaining_text {
if remaining_nodes == 1 {
write!(s, ", and {}", next.as_str()).unwrap();
break;
} else {
write!(s, ", and {} other nodes", remaining_nodes).unwrap();
break;
}
}
}

Expand Down

0 comments on commit b0a62f2

Please sign in to comment.