Kanban
This commit is contained in:
2023-10-20 12:31:59 -07:00
parent 61334d690b
commit 4712ad4e7b
13 changed files with 59 additions and 40 deletions

View File

@ -199,12 +199,29 @@ public class ProcessData : IProcessData
return result;
}
private static string GetTitle(FIBacklogMesa fiBacklogMesa)
{
string result = $"{fiBacklogMesa.Req} - {fiBacklogMesa.Subject.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)[0]}";
if (result.Length > 128)
result = result.Substring(0, 127);
return result;
}
private static string GetTitle(FIBacklogMesa fiBacklogMesa, ValueWithReq valueWithReq)
{
string result = $"{valueWithReq.Req} - {fiBacklogMesa.Subject.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)[0]}";
if (result.Length > 128)
result = result.Substring(0, 127);
return result;
}
private static string? GetMappedState(FIBacklogMesa fiBacklogMesa) =>
fiBacklogMesa.Status == "CMP" ? "Closed" : fiBacklogMesa.Status == "UAT" ? "Resolved" : fiBacklogMesa.Status == "In process" ? "Active" : null;
private static void SetSyncTag(WorkItemTrackingHttpClient workItemTrackingHttpClient, ReadOnlyDictionary<string, string> requestorNameToUser, Dictionary<string, FIBacklogMesa> keyToFIBacklogMesa, ReadOnlyCollection<ValueWithReq> valueWithReqCollection)
{
string key;
string title;
int priority;
bool isBugFix;
string? state;
@ -223,6 +240,7 @@ public class ProcessData : IProcessData
if (!keyToFIBacklogMesa.TryGetValue(key, out fiBacklogMesa))
continue;
tags = GetTags(fiBacklogMesa);
title = GetTitle(fiBacklogMesa, valueWithReq);
isBugFix = fiBacklogMesa.Priority == "0 - BugFix";
_ = requestorNameToUser.TryGetValue(fiBacklogMesa.Requestor, out string? requestorUser);
if (!string.IsNullOrEmpty(requestorUser) && (valueWithReq.Value.Fields.SystemAssignedTo is null || !valueWithReq.Value.Fields.SystemAssignedTo.UniqueName.Equals(requestorUser, StringComparison.CurrentCultureIgnoreCase)))
@ -230,7 +248,7 @@ public class ProcessData : IProcessData
Update(workItemTrackingHttpClient, sync, valueWithReq);
continue;
}
if (valueWithReq.Value.Fields.SystemTitle != $"{valueWithReq.Req} - {fiBacklogMesa.Subject}")
if (valueWithReq.Value.Fields.SystemTitle != title)
{
Update(workItemTrackingHttpClient, sync, valueWithReq);
continue;
@ -487,10 +505,11 @@ public class ProcessData : IProcessData
JsonPatchDocument result = new();
if (uatWorkItemTask.Result.Id is null)
throw new NotSupportedException();
string title = GetTitle(fiBacklogMesa);
AddPatch(result, "/relations/-", new WorkItemRelation() { Rel = "System.LinkTypes.Hierarchy-Forward", Url = uatWorkItemTask.Result.Url });
AddPatch(result, "/fields/System.AreaPath", project);
AddPatch(result, "/fields/System.IterationPath", project);
AddPatch(result, "/fields/System.Title", $"{fiBacklogMesa.Req} - {fiBacklogMesa.Subject}");
AddPatch(result, "/fields/System.Title", title);
string? state = GetMappedState(fiBacklogMesa);
if (!string.IsNullOrEmpty(state))
AddPatch(result, "/fields/System.State", state);
@ -563,10 +582,8 @@ public class ProcessData : IProcessData
JsonPatchDocument result = new();
if (userStoryWorkItemTask?.Result.Id is null)
throw new NotSupportedException();
string title = GetTitle(fiBacklogMesa);
int priority = GetPriority(fiBacklogMesa);
string title = $"{fiBacklogMesa.Req} - {fiBacklogMesa.Subject}";
if (title.Length > 128)
title = title.Substring(0, 127);
AddPatch(result, "/relations/-", new WorkItemRelation() { Rel = "System.LinkTypes.Hierarchy-Forward", Url = userStoryWorkItemTask.Result.Url });
AddPatch(result, "/fields/System.AreaPath", project);
if (tags.Count > 0)