Skip to content

Commit

Permalink
Expand config object to include semesters
Browse files Browse the repository at this point in the history
Set the parent based on semester + parent config.
  • Loading branch information
BillWagner committed Sep 25, 2024
1 parent eac1e08 commit 32f924b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
15 changes: 10 additions & 5 deletions actions/sequester/Quest2GitHub/Models/QuestWorkItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public static async Task<QuestWorkItem> CreateWorkItemAsync(QuestIssueOrPullRequ
int defaultParentNode)
{
string areaPath = $"""{questClient.QuestProject}\{path}""";
int parentId = parentIdFromIssue(parentNodes, issue, defaultParentNode);
int parentId = parentIdFromIssue(parentNodes, issue, defaultParentNode, allIterations);

List<JsonPatchDocument> patchDocument =
[
Expand Down Expand Up @@ -410,7 +410,7 @@ public static string BuildDescriptionFromIssue(QuestIssueOrPullRequest issue, st
IEnumerable<ParentForLabel> parentNodes,
int defaultParentNode)
{
int parentId = parentIdFromIssue(parentNodes, ghIssue, defaultParentNode);
int parentId = parentIdFromIssue(parentNodes, ghIssue, defaultParentNode, allIterations);
string? ghAssigneeEmailAddress = await ghIssue.QueryAssignedMicrosoftEmailAddressAsync(ospoClient);
AzDoIdentity? questAssigneeID = default;
var proposedQuestState = questItem.State;
Expand Down Expand Up @@ -557,13 +557,18 @@ public static string BuildDescriptionFromIssue(QuestIssueOrPullRequest issue, st
return newItem;
}

static private int parentIdFromIssue(IEnumerable<ParentForLabel> parentNodes, QuestIssueOrPullRequest ghIssue, int defaultParentNode)
static private int parentIdFromIssue(IEnumerable<ParentForLabel> parentNodes, QuestIssueOrPullRequest ghIssue, int defaultParentNode, IEnumerable<QuestIteration> allIterations)
{
var iteration = ghIssue.LatestStoryPointSize()?.ProjectIteration(allIterations);

foreach (ParentForLabel pair in parentNodes)
{
if (ghIssue.Labels.Any(l => l.Name == pair.Label))
if (ghIssue.Labels.Any(l => l.Name == pair.Label) || (pair.Label is null))
{
return pair.ParentNodeId;
if ((pair.Semester is null) || (iteration?.IsInSemester(pair.Semester) is true))
{
return pair.ParentNodeId;
}
}
}
return defaultParentNode;
Expand Down
4 changes: 4 additions & 0 deletions quest-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
{
"Semester": "Selenium",
"ParentNodeId": 286035
},
{
"Label": "user-feedback",
"ParentNodeId": 233465
}
],
"DefaultParentNode": 286035
Expand Down

0 comments on commit 32f924b

Please sign in to comment.