diff --git a/Adaptation/.vscode/mklink.md b/Adaptation/.vscode/mklink.md index ac35d79..a968c0b 100644 --- a/Adaptation/.vscode/mklink.md +++ b/Adaptation/.vscode/mklink.md @@ -2,4 +2,5 @@ ```bash mklink /J "T:\MESAFIBACKLOG\06_SourceCode\MESAFIBACKLOG\Adaptation\.kanbn" "D:\5-Other-Small\Kanban\MESAFIBACKLOG" +mklink /J "T:\MESAFIBACKLOG\06_SourceCode\MESAFIBACKLOG\Adaptation\.vscode\helper" "D:\web-sites\OI-Metrology\_markdown" ``` diff --git a/Adaptation/FileHandlers/Kanban/ProcessData.cs b/Adaptation/FileHandlers/Kanban/ProcessData.cs index 9658dd2..390efc5 100644 --- a/Adaptation/FileHandlers/Kanban/ProcessData.cs +++ b/Adaptation/FileHandlers/Kanban/ProcessData.cs @@ -208,11 +208,11 @@ public class ProcessData : IProcessData try { records = GetKeyValuePairs(keyValuePairs, keyValuePair.Value, nests); - record = new(keyValuePair.Value, parentWorkItem, records); + record = Record.Get(keyValuePair.Value, parentWorkItem, records); } catch (Exception) { - record = new(keyValuePair.Value, parentWorkItem, new(Array.Empty())); + record = new(keyValuePair.Value, parentWorkItem, Array.Empty()); } results.Add(keyValuePair.Key, record); } @@ -321,7 +321,7 @@ public class ProcessData : IProcessData else _ = keyValuePairs.TryGetValue(w.Parent.Value, out parentWorkItem); records = GetKeyValuePairs(keyValuePairs, w, nests); - record = new(w, parentWorkItem, records); + record = Record.Get(w, parentWorkItem, records); results.Add(record); } } diff --git a/Adaptation/FileHandlers/Markdown/ProcessData.cs b/Adaptation/FileHandlers/Markdown/ProcessData.cs index 74bd0fe..7544e06 100644 --- a/Adaptation/FileHandlers/Markdown/ProcessData.cs +++ b/Adaptation/FileHandlers/Markdown/ProcessData.cs @@ -80,19 +80,21 @@ public class ProcessData : IProcessData } List spaces = new(); List lines = new(); - ReadOnlyCollection results; + ReadOnlyCollection results; ReadOnlyDictionary keyValuePairs = GetWorkItems(workItems); ReadOnlyCollection records = new(keyValuePairs.Values.ToArray()); + ReadOnlyCollection bugFeatureWorkItemTypes = new(new string[] { "Bug", "Feature" }); ReadOnlyCollection bugUserStoryWorkItemTypes = new(new string[] { "Bug", "User Story" }); ReadOnlyCollection bugUserStoryTaskWorkItemTypes = new(new string[] { "Bug", "User Story", "Task" }); - WriteWithPartentsFile(fileRead, destinationDirectory, fileInfoCollection, records, "with-parents"); + WriteWithPartentsFile(fileRead, destinationDirectory, fileInfoCollection, records, bugFeatureWorkItemTypes, "bugs-features-with-parents"); + WriteWithPartentsFile(fileRead, destinationDirectory, fileInfoCollection, records, bugUserStoryWorkItemTypes, "bugs-user-stories-with-parents"); foreach (string workItemType in workItemTypes) { lines.Clear(); lines.Add($"# {workItemType}"); lines.Add(string.Empty); AppendLines(url, spaces, lines, records, workItemType); - results = new(Array.Empty()); + results = new(Array.Empty()); WriteFiles(fileRead, destinationDirectory, fileInfoCollection, new(lines), results, workItemType); _Details.Add(results); } @@ -101,7 +103,7 @@ public class ProcessData : IProcessData string workItemType = "Feature"; lines.Add($"# {nameof(FeatureCheckIterationPath122508)}"); lines.Add(string.Empty); - results = FeatureCheckIterationPath122508(url, lines, bugUserStoryTaskWorkItemTypes, records, workItemType); + results = FeatureCheckIterationPath122508(url, lines, bugUserStoryTaskWorkItemTypes, keyValuePairs, workItemType); WriteFiles(fileRead, destinationDirectory, fileInfoCollection, new(lines), results, "check-122508"); _Details.Add(results); } @@ -110,7 +112,7 @@ public class ProcessData : IProcessData string workItemType = "Feature"; lines.Add($"# {nameof(FeatureCheckTag122514)}"); lines.Add(string.Empty); - results = FeatureCheckTag122514(url, lines, bugUserStoryWorkItemTypes, records, workItemType); + results = FeatureCheckTag122514(url, lines, bugUserStoryWorkItemTypes, keyValuePairs, workItemType); WriteFiles(fileRead, destinationDirectory, fileInfoCollection, new(lines), results, "check-122514"); _Details.Add(results); } @@ -119,7 +121,7 @@ public class ProcessData : IProcessData string workItemType = "Feature"; lines.Add($"# {nameof(FeatureCheckPriority126169)}"); lines.Add(string.Empty); - results = FeatureCheckPriority126169(url, lines, bugUserStoryWorkItemTypes, records, workItemType); + results = FeatureCheckPriority126169(url, lines, bugUserStoryWorkItemTypes, keyValuePairs, workItemType); WriteFiles(fileRead, destinationDirectory, fileInfoCollection, new(lines), results, "check-126169"); _Details.Add(results); } @@ -128,7 +130,7 @@ public class ProcessData : IProcessData string workItemType = "Feature"; lines.Add($"# {nameof(FeatureCheckState123066)}"); lines.Add(string.Empty); - results = FeatureCheckState123066(url, lines, bugUserStoryTaskWorkItemTypes, records, workItemType); + results = FeatureCheckState123066(url, lines, bugUserStoryTaskWorkItemTypes, keyValuePairs, workItemType); WriteFiles(fileRead, destinationDirectory, fileInfoCollection, new(lines), results, "check-123066"); _Details.Add(results); } @@ -137,7 +139,7 @@ public class ProcessData : IProcessData string workItemType = "Feature"; lines.Add($"# {nameof(FeatureCheckState123067)}"); lines.Add(string.Empty); - results = FeatureCheckState123067(url, lines, bugUserStoryTaskWorkItemTypes, records, workItemType); + results = FeatureCheckState123067(url, lines, bugUserStoryTaskWorkItemTypes, keyValuePairs, workItemType); WriteFiles(fileRead, destinationDirectory, fileInfoCollection, new(lines), results, "check-123067"); _Details.Add(results); } @@ -146,13 +148,13 @@ public class ProcessData : IProcessData string workItemType = "Feature"; lines.Add($"# {nameof(FeatureCheckStart122517)}"); lines.Add(string.Empty); - results = FeatureCheckStart122517(url, lines, bugUserStoryTaskWorkItemTypes, records, workItemType); + results = FeatureCheckStart122517(url, lines, bugUserStoryTaskWorkItemTypes, keyValuePairs, workItemType); WriteFiles(fileRead, destinationDirectory, fileInfoCollection, new(lines), results, "check-122517"); _Details.Add(results); } } - private static void WriteFiles(IFileRead fileRead, string destinationDirectory, List fileInfoCollection, ReadOnlyCollection lines, ReadOnlyCollection workItems, string fileName) + private static void WriteFiles(IFileRead fileRead, string destinationDirectory, List fileInfoCollection, ReadOnlyCollection lines, ReadOnlyCollection records, string fileName) { string markdown = string.Join(Environment.NewLine, lines); string markdownFile = Path.Combine(destinationDirectory, $"{fileName}.md"); @@ -168,7 +170,7 @@ public class ProcessData : IProcessData File.WriteAllText(htmlFile, html); if (!fileRead.IsEAFHosted) fileInfoCollection.Add(new(htmlFile)); - string json = JsonSerializer.Serialize(workItems, new JsonSerializerOptions() { WriteIndented = true }); + string json = JsonSerializer.Serialize(records, new JsonSerializerOptions() { WriteIndented = true }); string jsonFile = Path.Combine(destinationDirectory, $"{fileName}.json"); string jsonOld = !File.Exists(jsonFile) ? string.Empty : File.ReadAllText(jsonFile); if (json != jsonOld) @@ -187,10 +189,18 @@ public class ProcessData : IProcessData return results; } - private static void WriteWithPartentsFile(IFileRead fileRead, string destinationDirectory, List fileInfoCollection, ReadOnlyCollection records, string fileName) + private static void WriteWithPartentsFile(IFileRead fileRead, string destinationDirectory, List fileInfoCollection, ReadOnlyCollection records, ReadOnlyCollection workItemTypes, string fileName) { - Record[] features = (from l in records where l.WorkItem.WorkItemType == "Feature" select l).ToArray(); - string json = JsonSerializer.Serialize(features, new JsonSerializerOptions() { WriteIndented = true }); + List filtered = new(); + Record record; + foreach (Record r in records) + { + if (r.WorkItem.State == "Removed" || !workItemTypes.Contains(r.WorkItem.WorkItemType)) + continue; + record = new(r.WorkItem, r.Parent, Array.Empty()); + filtered.Add(record); + } + string json = JsonSerializer.Serialize(filtered, new JsonSerializerOptions() { WriteIndented = true }); string jsonFile = Path.Combine(destinationDirectory, $"{fileName}.json"); string jsonOld = !File.Exists(jsonFile) ? string.Empty : File.ReadAllText(jsonFile); if (json != jsonOld) @@ -213,7 +223,7 @@ public class ProcessData : IProcessData results.Add($"## {record.WorkItem.AssignedTo} - {record.WorkItem.Id} - {record.WorkItem.Title}"); results.Add(string.Empty); results.Add($"- [{record.WorkItem.Id}]({url}{record.WorkItem.Id})"); - if (record.Children.Count == 0) + if (record.Children.Length == 0) results.Add(string.Empty); else { @@ -279,11 +289,11 @@ public class ProcessData : IProcessData try { records = GetKeyValuePairs(keyValuePairs, keyValuePair.Value, nests); - record = new(keyValuePair.Value, parentWorkItem, records); + record = Record.Get(keyValuePair.Value, parentWorkItem, records); } catch (Exception) { - record = new(keyValuePair.Value, parentWorkItem, new(Array.Empty())); + record = new(keyValuePair.Value, parentWorkItem, Array.Empty()); } results.Add(keyValuePair.Key, record); } @@ -332,7 +342,7 @@ public class ProcessData : IProcessData else _ = keyValuePairs.TryGetValue(w.Parent.Value, out parentWorkItem); records = GetKeyValuePairs(keyValuePairs, w, nests); - record = new(w, parentWorkItem, records); + record = Record.Get(w, parentWorkItem, records); results.Add(record); } } @@ -383,20 +393,20 @@ public class ProcessData : IProcessData return new(results); } - private static void FilterChildren(ReadOnlyCollection workItemTypes, Record record, List results) + private static void FilterChildren(ReadOnlyCollection workItemTypes, Record record, List results) { foreach (Record r in record.Children) { if (!workItemTypes.Contains(r.WorkItem.WorkItemType)) continue; - results.Add(r.WorkItem); + results.Add(r); FilterChildren(workItemTypes, r, results); } } - private static ReadOnlyCollection FilterChildren(ReadOnlyCollection workItemTypes, Record record) + private static ReadOnlyCollection FilterChildren(ReadOnlyCollection workItemTypes, Record record) { - List results = new(); + List results = new(); FilterChildren(workItemTypes, record, results); return new(results); } @@ -412,37 +422,39 @@ public class ProcessData : IProcessData _ => 8 }; - private static string? GetMaxIterationPath122508(ReadOnlyCollection workItems) + private static string? GetMaxIterationPath122508(ReadOnlyCollection records) { string? result; List results = new(); - foreach (WorkItem workItem in workItems) + foreach (Record record in records) { - if (results.Contains(workItem.IterationPath)) + if (results.Contains(record.WorkItem.IterationPath)) continue; - results.Add(workItem.IterationPath); + results.Add(record.WorkItem.IterationPath); } result = results.Count == 0 ? null : results.Max(); return result; } - private static ReadOnlyCollection FeatureCheckIterationPath122508(string url, List lines, ReadOnlyCollection workItemTypes, ReadOnlyCollection records, string workItemType) + private static ReadOnlyCollection FeatureCheckIterationPath122508(string url, List lines, ReadOnlyCollection workItemTypes, ReadOnlyDictionary keyValuePairs, string workItemType) { - List results = new(); + List results = new(); + Record record; string? maxIterationPath; List collection = new(); - ReadOnlyCollection childrenWorkItems; - foreach (Record record in records) + ReadOnlyCollection records; + foreach (KeyValuePair keyValuePair in keyValuePairs) { + record = keyValuePair.Value; if (record.WorkItem.State is "Removed") continue; if (record.WorkItem.WorkItemType != workItemType) continue; collection.Clear(); - if (record.Children.Count == 0) + if (record.Children.Length == 0) continue; - childrenWorkItems = FilterChildren(workItemTypes, record); - maxIterationPath = GetMaxIterationPath122508(childrenWorkItems); + records = FilterChildren(workItemTypes, record); + maxIterationPath = GetMaxIterationPath122508(records); if (string.IsNullOrEmpty(maxIterationPath) || record.WorkItem.IterationPath == maxIterationPath) continue; collection.Add($"## {record.WorkItem.AssignedTo} - {record.WorkItem.Id} - {record.WorkItem.Title}"); @@ -450,137 +462,141 @@ public class ProcessData : IProcessData collection.Add($"- [ ] [{record.WorkItem.Id}]({url}{record.WorkItem.Id}) => {record.WorkItem.IterationPath} != {maxIterationPath}"); collection.Add(string.Empty); lines.AddRange(collection); - results.Add(WorkItem.Get(record.WorkItem, $"IterationPath:{record.WorkItem.Id};{record.WorkItem.IterationPath} != {maxIterationPath}")); + results.Add(WorkItem.Get(record, $"IterationPath:{record.WorkItem.Id};{record.WorkItem.IterationPath} != {maxIterationPath}")); } return new(results); } - private static ReadOnlyCollection GetWorkItemsNotMatching122514(Record record, ReadOnlyCollection workItems) + private static ReadOnlyCollection GetWorkItemsNotMatching122514(Record record, ReadOnlyCollection records) { - List results = new(); + List results = new(); string[] segments; string[] parentTags = record.WorkItem.Tags.Split(';').Select(l => l.Trim()).ToArray(); - foreach (WorkItem workItem in workItems) + foreach (Record r in records) { - segments = string.IsNullOrEmpty(workItem.Tags) ? Array.Empty() : workItem.Tags.Split(';').Select(l => l.Trim()).ToArray(); + segments = string.IsNullOrEmpty(r.WorkItem.Tags) ? Array.Empty() : r.WorkItem.Tags.Split(';').Select(l => l.Trim()).ToArray(); if (segments.Length > 0 && parentTags.Any(l => segments.Contains(l))) continue; - results.Add(workItem); + results.Add(r); } return new(results); } - private static ReadOnlyCollection FeatureCheckTag122514(string url, List lines, ReadOnlyCollection workItemTypes, ReadOnlyCollection records, string workItemType) + private static ReadOnlyCollection FeatureCheckTag122514(string url, List lines, ReadOnlyCollection workItemTypes, ReadOnlyDictionary keyValuePairs, string workItemType) { - List results = new(); + List results = new(); + Record record; List collection = new(); List violations = new(); - ReadOnlyCollection childrenWorkItems; - ReadOnlyCollection workItemsNotMatching; - foreach (Record record in records) + ReadOnlyCollection records; + ReadOnlyCollection recordsNotMatching; + foreach (KeyValuePair keyValuePair in keyValuePairs) { + record = keyValuePair.Value; if (record.WorkItem.State is "Removed") continue; if (record.WorkItem.WorkItemType != workItemType) continue; collection.Clear(); violations.Clear(); - if (record.Children.Count == 0) + if (record.Children.Length == 0) continue; if (string.IsNullOrEmpty(record.WorkItem.Tags)) - workItemsNotMatching = new(new WorkItem[] { record.WorkItem }); + recordsNotMatching = new(new Record[] { record }); else { - childrenWorkItems = FilterChildren(workItemTypes, record); - workItemsNotMatching = GetWorkItemsNotMatching122514(record, childrenWorkItems); - if (!string.IsNullOrEmpty(record.WorkItem.Tags) && workItemsNotMatching.Count == 0) + records = FilterChildren(workItemTypes, record); + recordsNotMatching = GetWorkItemsNotMatching122514(record, records); + if (!string.IsNullOrEmpty(record.WorkItem.Tags) && recordsNotMatching.Count == 0) continue; } collection.Add($"## {record.WorkItem.AssignedTo} - {record.WorkItem.Id} - {record.WorkItem.Title}"); collection.Add(string.Empty); - foreach (WorkItem workItem in workItemsNotMatching) - collection.Add($"- [ ] [{workItem}]({url}{workItem}) {nameof(record.WorkItem.Tags)} != {record.WorkItem.Tags}"); + foreach (Record r in recordsNotMatching) + collection.Add($"- [ ] [{r.WorkItem}]({url}{r.WorkItem}) {nameof(record.WorkItem.Tags)} != {record.WorkItem.Tags}"); collection.Add(string.Empty); lines.AddRange(collection); violations.Add($"Tag:{record.WorkItem.Tags};"); - foreach (WorkItem workItem in workItemsNotMatching) - violations.Add($"{workItem.Id}:{workItem.Tags};"); - results.Add(WorkItem.Get(record.WorkItem, string.Join(" ", violations))); + foreach (Record r in recordsNotMatching) + violations.Add($"{r.WorkItem.Id}:{r.WorkItem.Tags};"); + results.Add(WorkItem.Get(record, string.Join(" ", violations))); } return new(results); } - private static ReadOnlyCollection GetWorkItemsNotMatching126169(Record record, ReadOnlyCollection workItems) + private static ReadOnlyCollection GetWorkItemsNotMatching126169(Record record, ReadOnlyCollection records) { - List results = new(); - foreach (WorkItem workItem in workItems) + List results = new(); + foreach (Record r in records) { if (record.WorkItem.Priority is null) { - results.Add(record.WorkItem); + results.Add(record); break; } - if (workItem.Priority == record.WorkItem.Priority.Value) + if (r.WorkItem.Priority == record.WorkItem.Priority.Value) continue; - results.Add(workItem); + results.Add(r); } return new(results); } - private static ReadOnlyCollection FeatureCheckPriority126169(string url, List lines, ReadOnlyCollection workItemTypes, ReadOnlyCollection records, string workItemType) + private static ReadOnlyCollection FeatureCheckPriority126169(string url, List lines, ReadOnlyCollection workItemTypes, ReadOnlyDictionary keyValuePairs, string workItemType) { - List results = new(); + List results = new(); + Record record; List collection = new(); List violations = new(); - ReadOnlyCollection childrenWorkItems; - ReadOnlyCollection workItemsNotMatching; - foreach (Record record in records) + ReadOnlyCollection records; + ReadOnlyCollection recordsNotMatching; + foreach (KeyValuePair keyValuePair in keyValuePairs) { + record = keyValuePair.Value; if (record.WorkItem.State is "Removed") continue; if (record.WorkItem.WorkItemType != workItemType) continue; collection.Clear(); violations.Clear(); - if (record.Children.Count == 0) + if (record.Children.Length == 0) continue; - childrenWorkItems = FilterChildren(workItemTypes, record); - workItemsNotMatching = GetWorkItemsNotMatching126169(record, childrenWorkItems); - if (workItemsNotMatching.Count == 0) + records = FilterChildren(workItemTypes, record); + recordsNotMatching = GetWorkItemsNotMatching126169(record, records); + if (recordsNotMatching.Count == 0) continue; collection.Add($"## {record.WorkItem.AssignedTo} - {record.WorkItem.Id} - {record.WorkItem.Title}"); collection.Add(string.Empty); collection.Add($"- [{record.WorkItem.Id}]({url}{record.WorkItem.Id})"); - foreach (WorkItem workItem in workItemsNotMatching) - collection.Add($"- [ ] [{workItem.Id}]({url}{workItem.Id}) {nameof(record.WorkItem.Priority)} != {record.WorkItem.Priority}"); + foreach (Record r in recordsNotMatching) + collection.Add($"- [ ] [{r.WorkItem.Id}]({url}{r.WorkItem.Id}) {nameof(record.WorkItem.Priority)} != {record.WorkItem.Priority}"); collection.Add(string.Empty); lines.AddRange(collection); violations.Add($"Priority:{record.WorkItem.Priority};"); - foreach (WorkItem workItem in workItemsNotMatching) - violations.Add($"{workItem.Id}:{workItem.Priority};"); - results.Add(WorkItem.Get(record.WorkItem, string.Join(" ", violations))); + foreach (Record r in recordsNotMatching) + violations.Add($"{r.WorkItem.Id}:{r.WorkItem.Priority};"); + results.Add(WorkItem.Get(record, string.Join(" ", violations))); } return new(results); } - private static ReadOnlyCollection GetWorkItemsNotMatching123066(Record record, ReadOnlyCollection workItems) + private static ReadOnlyCollection GetWorkItemsNotMatching123066(Record record, ReadOnlyCollection records) { - List results = new(); + List results = new(); int check; int state = GetState(record.WorkItem); - List> collection = new(); - foreach (WorkItem workItem in workItems) + List> collection = new(); + foreach (Record r in records) { - if (workItem.State is "Removed") + if (r.WorkItem.State is "Removed") continue; - check = GetState(workItem); + check = GetState(r.WorkItem); if (check == state) continue; - collection.Add(new(check, workItem)); + collection.Add(new(check, r)); } if (collection.Count > 0) { - KeyValuePair[] notNewState = (from l in collection where l.Value.State != "New" select l).ToArray(); + KeyValuePair[] notNewState = (from l in collection where l.Value.WorkItem.State != "New" select l).ToArray(); if (notNewState.Length == 0 && record.WorkItem.State is "New" or "Active") collection.Clear(); else if (notNewState.Length > 0) @@ -594,29 +610,29 @@ public class ProcessData : IProcessData collection.Clear(); } } - foreach (KeyValuePair keyValuePair in collection.OrderByDescending(l => l.Key)) + foreach (KeyValuePair keyValuePair in collection.OrderByDescending(l => l.Key)) results.Add(keyValuePair.Value); return new(results); } - private static ReadOnlyCollection GetWorkItemsNotMatching123067(Record record, ReadOnlyCollection workItems) + private static ReadOnlyCollection GetWorkItemsNotMatching123067(Record record, ReadOnlyCollection records) { - List results = new(); + List results = new(); int check; int state = GetState(record.WorkItem); - List> collection = new(); - foreach (WorkItem workItem in workItems) + List> collection = new(); + foreach (Record r in records) { - if (workItem.State is "Removed") + if (r.WorkItem.State is "Removed") continue; - check = GetState(workItem); + check = GetState(r.WorkItem); if (check == state) continue; - collection.Add(new(check, workItem)); + collection.Add(new(check, r)); } if (collection.Count > 0) { - KeyValuePair[] notNewState = (from l in collection where l.Value.State != "New" select l).ToArray(); + KeyValuePair[] notNewState = (from l in collection where l.Value.WorkItem.State != "New" select l).ToArray(); if (notNewState.Length == 0 && record.WorkItem.State is "New" or "Active") collection.Clear(); else if (notNewState.Length > 0) @@ -630,139 +646,145 @@ public class ProcessData : IProcessData collection.Clear(); } } - foreach (KeyValuePair keyValuePair in collection.OrderByDescending(l => l.Key)) + foreach (KeyValuePair keyValuePair in collection.OrderByDescending(l => l.Key)) results.Add(keyValuePair.Value); return new(results); } - private static ReadOnlyCollection GetWorkItemsNotMatching122517(Record record, ReadOnlyCollection workItems) + private static ReadOnlyCollection GetWorkItemsNotMatching122517(Record record, ReadOnlyCollection records) { - List results = new(); + List results = new(); if (record.WorkItem.StartDate is null) throw new Exception(); DateTime dateTime = record.WorkItem.StartDate.Value; - List> collection = new(); - foreach (WorkItem workItem in workItems) + List> collection = new(); + foreach (Record r in records) { - if (workItem.State is "Removed") + if (r.WorkItem.State is "Removed") continue; - if (workItem.ActivatedDate is null) + if (r.WorkItem.ActivatedDate is null) continue; - if (dateTime >= workItem.ActivatedDate.Value) + if (dateTime >= r.WorkItem.ActivatedDate.Value) continue; - collection.Add(new(workItem.ActivatedDate.Value.Ticks, workItem)); + collection.Add(new(r.WorkItem.ActivatedDate.Value.Ticks, r)); } - foreach (KeyValuePair keyValuePair in collection.OrderByDescending(l => l.Key)) + foreach (KeyValuePair keyValuePair in collection.OrderBy(l => l.Key)) results.Add(keyValuePair.Value); return new(results); } - private static ReadOnlyCollection FeatureCheckState123066(string url, List lines, ReadOnlyCollection workItemTypes, ReadOnlyCollection records, string workItemType) + private static ReadOnlyCollection FeatureCheckState123066(string url, List lines, ReadOnlyCollection workItemTypes, ReadOnlyDictionary keyValuePairs, string workItemType) { - List results = new(); + List results = new(); + Record record; List collection = new(); List violations = new(); - ReadOnlyCollection childrenWorkItems; - ReadOnlyCollection workItemsNotMatching; - foreach (Record record in records) + ReadOnlyCollection records; + ReadOnlyCollection recordsNotMatching; + foreach (KeyValuePair keyValuePair in keyValuePairs) { + record = keyValuePair.Value; if (record.WorkItem.State is "Removed") continue; if (record.WorkItem.WorkItemType != workItemType) continue; collection.Clear(); violations.Clear(); - if (record.Children.Count == 0) + if (record.Children.Length == 0) continue; - childrenWorkItems = FilterChildren(workItemTypes, record); - workItemsNotMatching = GetWorkItemsNotMatching123066(record, childrenWorkItems); - if (workItemsNotMatching.Count == 0) + records = FilterChildren(workItemTypes, record); + recordsNotMatching = GetWorkItemsNotMatching123066(record, records); + if (recordsNotMatching.Count == 0) continue; collection.Add($"## {record.WorkItem.AssignedTo} - {record.WorkItem.Id} - {record.WorkItem.Title}"); collection.Add(string.Empty); collection.Add($"- [{record.WorkItem.Id}]({url}{record.WorkItem.Id})"); - foreach (WorkItem workItem in workItemsNotMatching) - collection.Add($"- [ ] [{workItem.Id}]({url}{workItem.Id}) {nameof(record.WorkItem.State)} != {record.WorkItem.State}"); + foreach (Record r in recordsNotMatching) + collection.Add($"- [ ] [{r.WorkItem.Id}]({url}{r.WorkItem.Id}) {nameof(record.WorkItem.State)} != {record.WorkItem.State}"); collection.Add(string.Empty); lines.AddRange(collection); violations.Add($"State:{record.WorkItem.State};"); - foreach (WorkItem workItem in workItemsNotMatching) - violations.Add($"{workItem.Id}:{workItem.State};"); - results.Add(WorkItem.Get(record.WorkItem, string.Join(" ", violations))); + foreach (Record r in recordsNotMatching) + violations.Add($"{r.WorkItem.Id}:{r.WorkItem.State};"); + results.Add(WorkItem.Get(record, string.Join(" ", violations))); } return new(results); } - private static ReadOnlyCollection FeatureCheckState123067(string url, List lines, ReadOnlyCollection workItemTypes, ReadOnlyCollection records, string workItemType) + private static ReadOnlyCollection FeatureCheckState123067(string url, List lines, ReadOnlyCollection workItemTypes, ReadOnlyDictionary keyValuePairs, string workItemType) { - List results = new(); + List results = new(); + Record record; List collection = new(); List violations = new(); - ReadOnlyCollection childrenWorkItems; - ReadOnlyCollection workItemsNotMatching; - foreach (Record record in records) + ReadOnlyCollection records; + ReadOnlyCollection recordsNotMatching; + foreach (KeyValuePair keyValuePair in keyValuePairs) { + record = keyValuePair.Value; if (record.WorkItem.State is "Removed") continue; if (record.WorkItem.WorkItemType != workItemType) continue; collection.Clear(); violations.Clear(); - if (record.Children.Count == 0) + if (record.Children.Length == 0) continue; - childrenWorkItems = FilterChildren(workItemTypes, record); - workItemsNotMatching = GetWorkItemsNotMatching123067(record, childrenWorkItems); - if (workItemsNotMatching.Count == 0) + records = FilterChildren(workItemTypes, record); + recordsNotMatching = GetWorkItemsNotMatching123067(record, records); + if (recordsNotMatching.Count == 0) continue; collection.Add($"## {record.WorkItem.AssignedTo} - {record.WorkItem.Id} - {record.WorkItem.Title}"); collection.Add(string.Empty); collection.Add($"- [{record.WorkItem.Id}]({url}{record.WorkItem.Id})"); - foreach (WorkItem workItem in workItemsNotMatching) - collection.Add($"- [ ] [{workItem.Id}]({url}{workItem.Id}) {nameof(record.WorkItem.State)} != {record.WorkItem.State}"); + foreach (Record r in recordsNotMatching) + collection.Add($"- [ ] [{r.WorkItem.Id}]({url}{r.WorkItem.Id}) {nameof(record.WorkItem.State)} != {record.WorkItem.State}"); collection.Add(string.Empty); lines.AddRange(collection); violations.Add($"State:{record.WorkItem.State};"); - foreach (WorkItem workItem in workItemsNotMatching) - violations.Add($"{workItem.Id}:{workItem.State};"); - results.Add(WorkItem.Get(record.WorkItem, string.Join(" ", violations))); + foreach (Record r in recordsNotMatching) + violations.Add($"{r.WorkItem.Id}:{r.WorkItem.State};"); + results.Add(WorkItem.Get(record, string.Join(" ", violations))); } return new(results); } - private static ReadOnlyCollection FeatureCheckStart122517(string url, List lines, ReadOnlyCollection workItemTypes, ReadOnlyCollection records, string workItemType) + private static ReadOnlyCollection FeatureCheckStart122517(string url, List lines, ReadOnlyCollection workItemTypes, ReadOnlyDictionary keyValuePairs, string workItemType) { - List results = new(); + List results = new(); + Record record; List collection = new(); List violations = new(); - ReadOnlyCollection childrenWorkItems; - ReadOnlyCollection workItemsNotMatching; - foreach (Record record in records) + ReadOnlyCollection records; + ReadOnlyCollection recordsNotMatching; + foreach (KeyValuePair keyValuePair in keyValuePairs) { + record = keyValuePair.Value; if (record.WorkItem.State is "Removed") continue; if (record.WorkItem.WorkItemType != workItemType) continue; collection.Clear(); violations.Clear(); - if (record.Children.Count == 0) + if (record.Children.Length == 0) continue; if (record.WorkItem.StartDate is null) continue; - childrenWorkItems = FilterChildren(workItemTypes, record); - workItemsNotMatching = GetWorkItemsNotMatching122517(record, childrenWorkItems); - if (workItemsNotMatching.Count == 0) + records = FilterChildren(workItemTypes, record); + recordsNotMatching = GetWorkItemsNotMatching122517(record, records); + if (recordsNotMatching.Count == 0) continue; collection.Add($"## {record.WorkItem.AssignedTo} - {record.WorkItem.Id} - {record.WorkItem.Title}"); collection.Add(string.Empty); collection.Add($"- [{record.WorkItem.Id}]({url}{record.WorkItem.Id})"); - foreach (WorkItem workItem in workItemsNotMatching) - collection.Add($"- [ ] [{workItem.Id}]({url}{workItem.Id}) {nameof(record.WorkItem.ActivatedDate)} != {record.WorkItem.ActivatedDate}"); + foreach (Record r in recordsNotMatching) + collection.Add($"- [ ] [{r.WorkItem.Id}]({url}{r.WorkItem.Id}) {nameof(record.WorkItem.ActivatedDate)} != {record.WorkItem.ActivatedDate}"); collection.Add(string.Empty); lines.AddRange(collection); violations.Add($"StartDate:{record.WorkItem.StartDate};"); - foreach (WorkItem workItem in workItemsNotMatching) - violations.Add($"{workItem.Id}:{workItem.ActivatedDate};"); - results.Add(WorkItem.Get(record.WorkItem, string.Join(" ", violations))); + foreach (Record r in recordsNotMatching) + violations.Add($"{r.WorkItem.Id}:{r.WorkItem.ActivatedDate};"); + results.Add(WorkItem.Get(record, string.Join(" ", violations))); } return new(results); } diff --git a/Adaptation/FileHandlers/json/StaticSite/html/122517.html b/Adaptation/FileHandlers/json/StaticSite/html/122517.html index 927bb37..5559c0f 100644 --- a/Adaptation/FileHandlers/json/StaticSite/html/122517.html +++ b/Adaptation/FileHandlers/json/StaticSite/html/122517.html @@ -4,7 +4,7 @@ - Infineon - 122517 - Children of a Feature should have the same priority + Infineon - 122517 - Feature start date should be min activated date of children @@ -27,7 +27,7 @@