Skip to content

Make metric header not be "( )" when there is no metric #1409

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

Merged
merged 2 commits into from
Aug 16, 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
7 changes: 3 additions & 4 deletions site/src/comparison.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,11 +532,10 @@ pub fn write_summary_table(
.relevant_comparisons
.first()
.or(secondary.relevant_comparisons.first())
.map(|m| m.metric.as_str())
.map(|m| format!("({})", m.metric.as_str()))
})
.flatten()
// we want at least 10 spaces to accommodate "count[^2]"
.unwrap_or(" ");
.unwrap_or_else(|| String::from(" "));

fn render_stat<F: FnOnce() -> Option<f64>>(count: usize, calculate: F) -> String {
let value = if count > 0 { calculate() } else { None };
Expand Down Expand Up @@ -640,7 +639,7 @@ pub fn write_summary_table(
// This code attempts to space the table cells evenly so that the data is
// easy to read for anyone who is viewing the Markdown source.
let column_labels = [
format!("({metric})"),
metric,
format!("mean{}", if with_footnotes { "[^1]" } else { "" }),
"max".to_string(),
format!("count{}", if with_footnotes { "[^2]" } else { "" }),
Expand Down