Sync to Distinct Max Iteration Path
This commit is contained in:
@ -292,29 +292,42 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
private static void AppendLines(List<char> spaces, List<string> lines, ReadOnlyDictionary<int, Record> workItemAndChildren, string workItemType)
|
||||
{
|
||||
WorkItem workItem;
|
||||
string? maxIterationPath;
|
||||
List<string> distinct = new();
|
||||
foreach (KeyValuePair<int, Record> keyValuePair in workItemAndChildren)
|
||||
{
|
||||
workItem = keyValuePair.Value.WorkItem;
|
||||
// if (keyValuePair.Key != 109724)
|
||||
// continue;
|
||||
if (workItem.WorkItemType != workItemType)
|
||||
continue;
|
||||
lines.Add($"## {workItem.AssignedTo} - {workItem.Id} - {workItem.Title}");
|
||||
lines.Add(string.Empty);
|
||||
lines.Add($"- [{workItem.Id}](https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/{workItem.Id})");
|
||||
lines.Add(string.Empty);
|
||||
if (keyValuePair.Value.Children.Count > 0)
|
||||
if (keyValuePair.Value.Children.Count == 0)
|
||||
lines.Add(string.Empty);
|
||||
else
|
||||
{
|
||||
AppendLines(spaces, lines, keyValuePair.Value, condensed: true, sprintOnly: false);
|
||||
lines.Add(string.Empty);
|
||||
distinct.Clear();
|
||||
lines.Add($"## Distinct Iteration Path(s) - {workItem.WorkItemType} - {workItem.AssignedTo} - {workItem.Id} - {workItem.Title} - {workItem.IterationPath}");
|
||||
lines.Add(string.Empty);
|
||||
lines.Add($"- [{workItem.Id}](https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/{workItem.Id})");
|
||||
lines.Add(string.Empty);
|
||||
AppendLines(spaces, distinct, keyValuePair.Value, condensed: false, sprintOnly: true);
|
||||
distinct.Sort();
|
||||
lines.AddRange(distinct.Distinct());
|
||||
lines.Add(string.Empty);
|
||||
if (distinct.Count > 1)
|
||||
{
|
||||
lines.Add($"## Distinct Iteration Path(s) - {workItem.WorkItemType} - {workItem.AssignedTo} - {workItem.Id} - {workItem.Title} - {workItem.IterationPath}");
|
||||
lines.Add(string.Empty);
|
||||
lines.Add($"- [{workItem.Id}](https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/{workItem.Id})");
|
||||
distinct.Sort();
|
||||
distinct = (from l in distinct select l.Trim()).Distinct().ToList();
|
||||
lines.AddRange(distinct);
|
||||
lines.Add(string.Empty);
|
||||
maxIterationPath = distinct.Max();
|
||||
if (!string.IsNullOrEmpty(maxIterationPath) && maxIterationPath.Contains("] ") && maxIterationPath.Split(']')[1].Trim() != workItem.IterationPath)
|
||||
{
|
||||
lines.Add($"### Sync to Distinct Max Iteration Path => {maxIterationPath} - {workItem.Id} - {workItem.Title}");
|
||||
lines.Add(string.Empty);
|
||||
}
|
||||
}
|
||||
lines.Add($"## Extended - {workItem.Id} - {workItem.Title}");
|
||||
lines.Add(string.Empty);
|
||||
AppendLines(spaces, lines, keyValuePair.Value, condensed: false, sprintOnly: false);
|
||||
@ -333,7 +346,6 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
string? pathRoot;
|
||||
List<char> spaces = new();
|
||||
List<string> lines = new();
|
||||
lines.Add("# WorkItems");
|
||||
ReadOnlyDictionary<int, WorkItem> keyValuePairs = GetWorkItems(workItems);
|
||||
ReadOnlyDictionary<int, Record> workItemAndChildren = GetWorkItemAndChildren(keyValuePairs);
|
||||
foreach (string alternateTargetFolder in alternateTargetFolders)
|
||||
@ -359,6 +371,9 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
}
|
||||
foreach (string workItemType in workItemTypes)
|
||||
{
|
||||
lines.Clear();
|
||||
lines.Add("# WorkItems");
|
||||
lines.Add(string.Empty);
|
||||
AppendLines(spaces, lines, workItemAndChildren, workItemType);
|
||||
checkFile = Path.Combine(alternateTargetFolder, $"{workItemType}.md");
|
||||
text = string.Join(Environment.NewLine, lines);
|
||||
|
Reference in New Issue
Block a user