Tag property on Record
Fetch javascript function for testing Absolute Delta
This commit is contained in:
parent
3e8f5931e2
commit
9c5e6fddf2
6
Adaptation/.vscode/launch.json
vendored
6
Adaptation/.vscode/launch.json
vendored
@ -5,6 +5,12 @@
|
|||||||
"type": "coreclr",
|
"type": "coreclr",
|
||||||
"request": "attach",
|
"request": "attach",
|
||||||
"processId": 22868
|
"processId": 22868
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "node Launch Current Opened File",
|
||||||
|
"program": "${file}"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,8 @@ public class ProcessData : IProcessData
|
|||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
record = new(keyValuePair.Value, parentWorkItem, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>());
|
Dictionary<string, string>? tag = null;
|
||||||
|
record = new(keyValuePair.Value, parentWorkItem, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>(), tag);
|
||||||
}
|
}
|
||||||
results.Add(keyValuePair.Key, record);
|
results.Add(keyValuePair.Key, record);
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,8 @@ public class ProcessData : IProcessData
|
|||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
record = new(keyValuePair.Value, parentWorkItem, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>());
|
Dictionary<string, string>? tag = null;
|
||||||
|
record = new(keyValuePair.Value, parentWorkItem, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>(), tag);
|
||||||
}
|
}
|
||||||
results.Add(keyValuePair.Key, record);
|
results.Add(keyValuePair.Key, record);
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,8 @@ public class ProcessData : IProcessData
|
|||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
record = new(keyValuePair.Value, parentWorkItem, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>());
|
Dictionary<string, string>? tag = null;
|
||||||
|
record = new(keyValuePair.Value, parentWorkItem, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>(), tag);
|
||||||
}
|
}
|
||||||
results.Add(keyValuePair.Key, record);
|
results.Add(keyValuePair.Key, record);
|
||||||
}
|
}
|
||||||
@ -174,7 +175,7 @@ public class ProcessData : IProcessData
|
|||||||
{
|
{
|
||||||
if (r.WorkItem.State == "Removed" || !workItemTypes.Contains(r.WorkItem.WorkItemType))
|
if (r.WorkItem.State == "Removed" || !workItemTypes.Contains(r.WorkItem.WorkItemType))
|
||||||
continue;
|
continue;
|
||||||
record = new(r.WorkItem, r.Parent, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>());
|
record = new(r.WorkItem, r.Parent, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>(), r.Tag);
|
||||||
filtered.Add(record);
|
filtered.Add(record);
|
||||||
}
|
}
|
||||||
string? json = GetJson(filtered, results);
|
string? json = GetJson(filtered, results);
|
||||||
|
@ -155,7 +155,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
matchDirectoryFileName = Path.GetFileName(matchDirectoryFile);
|
matchDirectoryFileName = Path.GetFileName(matchDirectoryFile);
|
||||||
if (jobIdDirectoryFileName.StartsWith(matchDirectoryFileName))
|
if (jobIdDirectoryFileName.StartsWith(matchDirectoryFileName))
|
||||||
{
|
{
|
||||||
checkFile = Path.Combine(matchDirectory, Path.GetFileName(matchDirectoryFile));
|
checkFile = Path.Combine(matchDirectory, jobIdDirectoryFileName);
|
||||||
if (File.Exists(checkFile))
|
if (File.Exists(checkFile))
|
||||||
continue;
|
continue;
|
||||||
File.Move(jobIdDirectoryFile, checkFile);
|
File.Move(jobIdDirectoryFile, checkFile);
|
||||||
|
@ -173,7 +173,8 @@ public class ProcessData : IProcessData
|
|||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
record = new(keyValuePair.Value, parentWorkItem, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>());
|
Dictionary<string, string>? tag = null;
|
||||||
|
record = new(keyValuePair.Value, parentWorkItem, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>(), tag);
|
||||||
}
|
}
|
||||||
results.Add(keyValuePair.Key, record);
|
results.Add(keyValuePair.Key, record);
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
@ -2,6 +2,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text.Json;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace Adaptation.FileHandlers.json.WorkItems;
|
namespace Adaptation.FileHandlers.json.WorkItems;
|
||||||
@ -12,13 +13,14 @@ internal class Record
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
|
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public Record(WorkItem workItem, WorkItem? parent, Record[]? children, Record[]? related, Record[]? successors)
|
public Record(WorkItem workItem, WorkItem? parent, Record[]? children, Record[]? related, Record[]? successors, Dictionary<string, string>? tag)
|
||||||
{
|
{
|
||||||
WorkItem = workItem;
|
WorkItem = workItem;
|
||||||
Parent = parent;
|
Parent = parent;
|
||||||
Children = children;
|
Children = children;
|
||||||
Related = related;
|
Related = related;
|
||||||
Successors = successors;
|
Successors = successors;
|
||||||
|
Tag = tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonPropertyName("WorkItem")] public WorkItem WorkItem { get; set; }
|
[JsonPropertyName("WorkItem")] public WorkItem WorkItem { get; set; }
|
||||||
@ -26,6 +28,7 @@ internal class Record
|
|||||||
[JsonPropertyName("Children")] public Record[]? Children { get; set; }
|
[JsonPropertyName("Children")] public Record[]? Children { get; set; }
|
||||||
[JsonPropertyName("Related")] public Record[]? Related { get; set; }
|
[JsonPropertyName("Related")] public Record[]? Related { get; set; }
|
||||||
[JsonPropertyName("Successors")] public Record[]? Successors { get; set; }
|
[JsonPropertyName("Successors")] public Record[]? Successors { get; set; }
|
||||||
|
[JsonPropertyName("Tag")] public Dictionary<string, string>? Tag { get; set; }
|
||||||
|
|
||||||
internal static Record GetWithoutNesting(Record record, string? violation)
|
internal static Record GetWithoutNesting(Record record, string? violation)
|
||||||
{
|
{
|
||||||
@ -60,7 +63,7 @@ internal class Record
|
|||||||
violation: record.WorkItem.Violation is null ? violation : record.WorkItem.Violation,
|
violation: record.WorkItem.Violation is null ? violation : record.WorkItem.Violation,
|
||||||
weightedShortestJobFirst: record.WorkItem.WeightedShortestJobFirst,
|
weightedShortestJobFirst: record.WorkItem.WeightedShortestJobFirst,
|
||||||
workItemType: record.WorkItem.WorkItemType);
|
workItemType: record.WorkItem.WorkItemType);
|
||||||
result = new(workItem, record.Parent, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>());
|
result = new(workItem, record.Parent, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>(), record.Tag);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,14 +103,40 @@ internal class Record
|
|||||||
relationRecords.Add(Get(r, keepRelations));
|
relationRecords.Add(Get(r, keepRelations));
|
||||||
successorRecords = relationRecords.ToArray();
|
successorRecords = relationRecords.ToArray();
|
||||||
}
|
}
|
||||||
result = new(workItem, parentWorkItem, childRecords, relatedRecords, successorRecords);
|
result = new(workItem, parentWorkItem, childRecords, relatedRecords, successorRecords, record.Tag);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static Dictionary<string, string>? GetTag(ReadOnlyCollection<Record>? records)
|
||||||
|
{
|
||||||
|
Dictionary<string, string>? result;
|
||||||
|
if (records is null)
|
||||||
|
result = null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
List<long> collection = new();
|
||||||
|
foreach (Record record in records)
|
||||||
|
{
|
||||||
|
if (record.WorkItem.State is "Closed" or "Resolved" || record.WorkItem.StoryPoints is null)
|
||||||
|
continue;
|
||||||
|
collection.Add(record.WorkItem.StoryPoints.Value);
|
||||||
|
}
|
||||||
|
if (collection.Count == 0)
|
||||||
|
result = null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string json = JsonSerializer.Serialize(collection);
|
||||||
|
result = new Dictionary<string, string> { { "StoryPoints", json } };
|
||||||
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static Record Get(WorkItem workItem, WorkItem? parent, ReadOnlyCollection<Record>? children, ReadOnlyCollection<Record>? related, ReadOnlyCollection<Record>? successors, bool keepRelations)
|
internal static Record Get(WorkItem workItem, WorkItem? parent, ReadOnlyCollection<Record>? children, ReadOnlyCollection<Record>? related, ReadOnlyCollection<Record>? successors, bool keepRelations)
|
||||||
{
|
{
|
||||||
Record result;
|
Record result;
|
||||||
Record record = new(workItem, parent, children?.ToArray(), related?.ToArray(), successors?.ToArray());
|
Dictionary<string, string>? tag = GetTag(children);
|
||||||
|
Record record = new(workItem, parent, children?.ToArray(), related?.ToArray(), successors?.ToArray(), tag);
|
||||||
result = Get(record, keepRelations);
|
result = Get(record, keepRelations);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ public class MESAFIBACKLOG
|
|||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG
|
#if (!DEBUG)
|
||||||
[Ignore]
|
[Ignore]
|
||||||
#endif
|
#endif
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user