Iteration Path

This commit is contained in:
Mike Phares 2024-09-16 10:43:51 -07:00
parent 513e8ae4fc
commit 65e31b09cc

View File

@ -271,19 +271,20 @@ public class FileRead : Shared.FileRead, IFileRead
return result;
}
private static string GetLine(List<char> spaces, WorkItem workItem, KeyValuePair<int, Record> keyValuePair, bool condensed) =>
!condensed ? $"{new string(spaces.Skip(1).ToArray())}- {GetClosed(workItem)} {keyValuePair.Key} - {workItem.Title}" :
$"{new string(spaces.Skip(1).ToArray())}- {GetClosed(workItem)} {keyValuePair.Key} - {workItem.Title} ~~~ {workItem.AssignedTo} - {workItem.IterationPath.Replace('\\', '-')} - {workItem.CreatedDate} --- {workItem.ClosedDate}";
private static string GetLine(List<char> spaces, WorkItem workItem, KeyValuePair<int, Record> keyValuePair, bool condensed, bool sprintOnly) =>
sprintOnly ? $"\t- [ ] {workItem.IterationPath}" :
condensed ? $"{new string(spaces.Skip(1).ToArray())}- {GetClosed(workItem)} {keyValuePair.Key} - {workItem.Title}" :
$"{new string(spaces.Skip(1).ToArray())}- {GetClosed(workItem)} {keyValuePair.Key} - {workItem.Title} ~~~ {workItem.AssignedTo} - {workItem.IterationPath.Replace('\\', '-')} - {workItem.CreatedDate} --- {workItem.ClosedDate}";
private static void AppendLines(List<char> spaces, List<string> lines, Record record, bool condensed)
private static void AppendLines(List<char> spaces, List<string> lines, Record record, bool condensed, bool sprintOnly)
{
spaces.Add('\t');
WorkItem workItem;
foreach (KeyValuePair<int, Record> keyValuePair in record.Children)
{
workItem = keyValuePair.Value.WorkItem;
lines.Add(GetLine(spaces, workItem, keyValuePair, condensed));
AppendLines(spaces, lines, keyValuePair.Value, condensed);
lines.Add(GetLine(spaces, workItem, keyValuePair, condensed, sprintOnly));
AppendLines(spaces, lines, keyValuePair.Value, condensed, sprintOnly);
}
spaces.RemoveAt(0);
}
@ -291,6 +292,7 @@ public class FileRead : Shared.FileRead, IFileRead
private static void AppendLines(List<char> spaces, List<string> lines, ReadOnlyDictionary<int, Record> workItemAndChildren, string workItemType)
{
WorkItem workItem;
List<string> distinct = new();
foreach (KeyValuePair<int, Record> keyValuePair in workItemAndChildren)
{
workItem = keyValuePair.Value.WorkItem;
@ -302,11 +304,20 @@ public class FileRead : Shared.FileRead, IFileRead
lines.Add(string.Empty);
if (keyValuePair.Value.Children.Count > 0)
{
AppendLines(spaces, lines, keyValuePair.Value, condensed: true);
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);
lines.Add($"## Extended - {workItem.Id} - {workItem.Title}");
lines.Add(string.Empty);
AppendLines(spaces, lines, keyValuePair.Value, condensed: false);
AppendLines(spaces, lines, keyValuePair.Value, condensed: false, sprintOnly: false);
lines.Add(string.Empty);
}
}