Skip to content

Commit

Permalink
Show resolution in the status table
Browse files Browse the repository at this point in the history
  • Loading branch information
Marek Suchánek committed Sep 7, 2023
1 parent 8c4d070 commit 1b568e8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/status_report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,21 @@ impl AbstractTicket {
self.components.join(", ")
}
}

/// Display the status, and if closed, also the resolution.
fn display_status(&self) -> String {
// For closed tickets, attach the resolution to the status.
if self.status.to_lowercase() == "closed" {
let resolution = match &self.resolution {
Some(resolution) => resolution.as_str(),
None => "no resolution",
};
format!("{}: {}", self.status, resolution)
// For open tickets, simply list the status as is.
} else {
self.status.clone()
}
}
}

/// Extract the account name before `@` from an email address.
Expand Down
3 changes: 3 additions & 0 deletions src/ticket_abstraction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pub struct AbstractTicket {
pub doc_text: String,
pub docs_contact: DocsContact,
pub status: String,
pub resolution: Option<String>,
pub is_open: bool,
pub priority: String,
pub url: String,
Expand Down Expand Up @@ -141,6 +142,7 @@ impl IntoAbstract for Bug {
url: self.url(config),
summary: self.summary,
status: self.status,
resolution: Some(self.resolution),
is_open: self.is_open,
priority: self.priority,
// Bugs are always assigned to someone.
Expand Down Expand Up @@ -191,6 +193,7 @@ impl IntoAbstract for Issue {
description: self.fields.description,
is_open: &self.fields.status.name != "Closed",
status: self.fields.status.name,
resolution: self.fields.resolution.map(|resolution| resolution.name),
priority: self
.fields
.priority
Expand Down
2 changes: 1 addition & 1 deletion templates/status-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ <h2>Duplicated tickets:</h2>
<td style="color: {{ overall_status.color() }}">{{ overall_status.message() }}</td>
<td>{{ ticket.doc_type }}</td>
<td style="text-align: center;">{{ ticket.doc_text_status }}</td>
<td style="color: {{ checks.development.color() }}">{{ ticket.status }}</td>
<td style="color: {{ checks.development.color() }}">{{ ticket.display_status() }}</td>
<td>{{ ticket.docs_contact_short() }}</td>
<td>{{ ticket.assignee_short() }}</td>
<td>{{ ticket.display_target_releases() }}</td>
Expand Down

0 comments on commit 1b568e8

Please sign in to comment.