Only place real "Ultimate Goal" elements at the bottom of the graph
All checks were successful
/ build (push) Successful in 1m12s
All checks were successful
/ build (push) Successful in 1m12s
"Ultimate Goal" elements are only counted as such if they fulfil the following requirements: - They have the "Ultimate Goal" issue label - They are not depended on by any other elements
This commit is contained in:
parent
8b0aef0599
commit
81ce471d0e
1 changed files with 18 additions and 7 deletions
|
|
@ -199,13 +199,24 @@ impl Tree {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn iter_ultimate_elements<'a>(&'a self) -> impl Iterator<Item = ElementIndex> + 'a {
|
pub fn iter_ultimate_elements<'a>(&'a self) -> impl Iterator<Item = ElementIndex> + 'a {
|
||||||
self.graph.node_indices().filter(|index| {
|
self.graph
|
||||||
// If there are no incoming edges, then this is an ultimate element!
|
.node_indices()
|
||||||
self.graph
|
.filter(|index| {
|
||||||
.neighbors_directed(*index, petgraph::Direction::Incoming)
|
self.graph.node_weight(*index).unwrap().status == ElementStatus::UltimateGoal
|
||||||
.next()
|
})
|
||||||
.is_none()
|
.filter(|index| {
|
||||||
})
|
// Ultimate goal elements must not have any incoming dependency edges. Warn and
|
||||||
|
// ignore it, if one does.
|
||||||
|
let has_no_incoming = self.graph
|
||||||
|
.neighbors_directed(*index, petgraph::Direction::Incoming)
|
||||||
|
.next()
|
||||||
|
.is_none();
|
||||||
|
if !has_no_incoming {
|
||||||
|
let el = self.graph.node_weight(*index).unwrap();
|
||||||
|
log::warn!("Element #{} is marked \"Ultimate Goal\" but is depended on by others? Ignoring...", el.issue_number);
|
||||||
|
}
|
||||||
|
has_no_incoming
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_element_role(&self, element: ElementIndex) -> ElementRole {
|
pub fn get_element_role(&self, element: ElementIndex) -> ElementRole {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue