Don't use the open/close state of the issues to mark their completion. This has friction with dependencies, because you can only add dependencies on open issues. Instead, issues are marked as completed using a "Completed" label now.
This commit is contained in:
parent
8ae5ff6b81
commit
b484256246
|
@ -127,7 +127,7 @@ The status of each element is determined as follows:
|
|||
|
||||
- **MISSING** when the element has not yet been achieved.
|
||||
- **ASSIGNED** when the issue has been assigned to someone. This means we are making progress!
|
||||
- **COMPLETED** when the issue gets closed. Achievement unlocked!
|
||||
- **COMPLETED** when the issue is labelled `Completed`. Achievement unlocked!
|
||||
|
||||
#### Important notes
|
||||
There are a few gotchas that you should be aware of:
|
||||
|
@ -136,10 +136,5 @@ There are a few gotchas that you should be aware of:
|
|||
unfortunately. You can force a trigger by editing the issue body or quickly
|
||||
adding and then removing the `Stale` label.
|
||||
|
||||
- You cannot add dependencies on closed issues via the Forgejo interface. To
|
||||
model such dependencies, temporarily reopen the dependency issue and close it
|
||||
again after adding the relationship.
|
||||
|
||||
- Issues that should no longer be a part of the techtree should either be
|
||||
deleted (looses all tracking) or they can be made inert by removing the
|
||||
`Type/###` label.
|
||||
deleted (looses all tracking) or they can be made inert by closing them.
|
||||
|
|
|
@ -77,10 +77,12 @@ fn element_from_issue(issue: &forgejo_api::structs::Issue) -> anyhow::Result<cra
|
|||
.context("Issue is missing a title")?
|
||||
.to_owned();
|
||||
|
||||
let ty_labels: Vec<_> = issue
|
||||
let labels = issue
|
||||
.labels
|
||||
.as_ref()
|
||||
.context("Issue does not have any labels")?
|
||||
.context("Issue does not have any labels")?;
|
||||
|
||||
let ty_labels: Vec<_> = labels
|
||||
.iter()
|
||||
.filter_map(|l| l.name.as_deref())
|
||||
.filter(|l| l.starts_with("Type/"))
|
||||
|
@ -100,9 +102,15 @@ fn element_from_issue(issue: &forgejo_api::structs::Issue) -> anyhow::Result<cra
|
|||
.unwrap()
|
||||
.to_owned();
|
||||
|
||||
let has_completed_label = labels
|
||||
.iter()
|
||||
.any(|l| l.name.as_deref() == Some("Completed"));
|
||||
|
||||
let status = match issue.state.context("Missing issue state")? {
|
||||
forgejo_api::structs::StateType::Open => {
|
||||
if issue.assignee.is_some()
|
||||
if has_completed_label {
|
||||
crate::tree::ElementStatus::Completed
|
||||
} else if issue.assignee.is_some()
|
||||
|| issue
|
||||
.assignees
|
||||
.as_ref()
|
||||
|
@ -114,7 +122,7 @@ fn element_from_issue(issue: &forgejo_api::structs::Issue) -> anyhow::Result<cra
|
|||
crate::tree::ElementStatus::Missing
|
||||
}
|
||||
}
|
||||
forgejo_api::structs::StateType::Closed => crate::tree::ElementStatus::Completed,
|
||||
forgejo_api::structs::StateType::Closed => anyhow::bail!("Ignoring closed issue!"),
|
||||
};
|
||||
|
||||
Ok(crate::tree::Element {
|
||||
|
|
Loading…
Reference in a new issue