From dbb856a7d98b163a6d54e1025a36f91e5389c618 Mon Sep 17 00:00:00 2001 From: Timothy Andrew Date: Mon, 8 Jun 2020 22:00:37 +0530 Subject: [PATCH] 'Merged' note --- src/api/search.rs | 7 +++++++ src/markdown.rs | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/api/search.rs b/src/api/search.rs index e666772..5c50d3b 100644 --- a/src/api/search.rs +++ b/src/api/search.rs @@ -68,6 +68,13 @@ impl PullRequest { pub fn body(&self) -> &str { &self.body } + + pub fn note(&self) -> &str { + match &self.state { + PullRequestStatus::Open => "N/A", + PullRequestStatus::Closed => "Merged" + } + } } #[derive(Deserialize, Debug)] diff --git a/src/markdown.rs b/src/markdown.rs index f9717f1..2662853 100644 --- a/src/markdown.rs +++ b/src/markdown.rs @@ -34,7 +34,7 @@ pub fn build_table(graph: Graph, usize>, title: &str) -> String node.title(), graph[parent.source()].number() ), - None => format!("|#{}|{}|**N/A**|\n", node.number(), node.title()), + None => format!("|#{}|{}|**{}**|\n", node.number(), node.title(), node.note()), }; out.push_str(&process(row));