diff --git a/src/pages.rs b/src/pages.rs index 9b47ba6b..334e529f 100644 --- a/src/pages.rs +++ b/src/pages.rs @@ -161,9 +161,13 @@ impl PageData { } }; + let runs = self.runs(rid); + table.push_child( Element::new(Tag::Tr) - .with_child(Element::new(Tag::Td).with_child(Self::repository(rid, &alias))) + .with_child( + Element::new(Tag::Td).with_child(Self::repository(rid, &alias, runs)), + ) .with_child(Element::new(Tag::Td).with_child(run_ids)) .with_child( Element::new(Tag::Td).with_child( @@ -377,14 +381,27 @@ impl PageData { page.push_to_body(Element::new(Tag::P).with_text(text)); } - fn repository(repo_id: RepoId, alias: &str) -> Element { - Element::new(Tag::A) + fn repository(repo_id: RepoId, alias: &str, runs: Vec<&Run>) -> Element { + let failed = runs + .iter() + .filter(|run| run.result() == Some(&RunResult::Failure)) + .count(); + let total = runs.len(); + + Element::new(Tag::Span) .with_child( - Element::new(Tag::Code) - .with_class("alias)") - .with_text(alias), + Element::new(Tag::A) + .with_child( + Element::new(Tag::Code) + .with_class("alias)") + .with_text(alias), + ) + .with_attribute("href", &format!("{}.html", rid_to_basename(repo_id))), ) - .with_attribute("href", &format!("{}.html", rid_to_basename(repo_id))) + .with_child(Element::new(Tag::Br)) + .with_child(Element::new(Tag::Span).with_text(&format!("{failed} failed runs"))) + .with_child(Element::new(Tag::Br)) + .with_child(Element::new(Tag::Span).with_text(&format!("{total} total runs"))) } fn run_ids(run: Option<&Run>) -> Element {