UpdateIteration
This commit is contained in:
parent
ee7841d9c3
commit
c7bcb4a5ea
11
.vscode/launch.json
vendored
11
.vscode/launch.json
vendored
@ -13,17 +13,18 @@
|
||||
"args": [
|
||||
"s",
|
||||
"X",
|
||||
"L:/DevOps/Mesa_FI/File-Folder-Helper/.vscode/helper/tfs",
|
||||
"Day-Helper-2024-08-30",
|
||||
"T:/MESAFIBACKLOG/06_SourceCode/MESAFIBACKLOG/Adaptation/.vscode/helper",
|
||||
"Day-Helper-2024-08-09",
|
||||
"MES",
|
||||
"https://tfs.intra.infineon.com",
|
||||
"/tfs/FactoryIntegration",
|
||||
"ART SPS",
|
||||
"/0d06e969-e1f5-4835-a359-620d557c7595/_apis/wit",
|
||||
"/wiql/28112411-4edf-44bb-adf3-ffbc4b402681",
|
||||
"/wiql/3373b300-8de3-4301-9795-e990c3b226f9",
|
||||
"4n7d2jcql6bkq32f66tohddonfxajkypq66lm5y3zqemtlohawsa",
|
||||
"https://tfs.intra.infineon.com/tfs/FactoryIntegration/0d06e969-e1f5-4835-a359-620d557c7595/_backlogs/backlog/LEO%20Team/Features/",
|
||||
"https://tfs.intra.infineon.com/tfs/FactoryIntegration/0d06e969-e1f5-4835-a359-620d557c7595/_backlogs/backlog/MES%20Team/Features/"
|
||||
"FI Backlog Mesa - Request List.json",
|
||||
"Chase|infineon\\TuckerC,Dakota(SRP)|infineon\\Mitchem,Daniel|infineon\\StieberD,Jonathan|infineon\\Ouellette,Mike|infineon\\Phares",
|
||||
"Chad B|infineon\\cbecker1,Debra Q|infineon\\Quinones,Jeanne M|infineon\\jmcinty2,Jessica F|infineon\\jfuente1,Jonathon S|infineon\\jsperli1,Justin H|infineon\\jhollan2,Kelly C|infineon\\kclark1,Mark C|infineon\\mcouste1,Marti J|infineon\\mjarsey1,Nik C|infineon\\nclark1,Peyton M|infineon\\McChesne,Ron O|infineon\\HendersS,Susan H|infineon\\HendersS,Tiffany M|infineon\\tmunoz1,Todd C|infineon\\tcarrie1"
|
||||
],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"console": "integratedTerminal",
|
||||
|
@ -218,6 +218,41 @@ internal static partial class Helper20240809
|
||||
}
|
||||
}
|
||||
|
||||
private static void UpdateIteration(HttpClient httpClient,
|
||||
string basePage,
|
||||
string api,
|
||||
int id,
|
||||
int rev)
|
||||
{
|
||||
string json = /*lang=json,strict*/ string.Concat("[ { \"op\": \"test\", \"path\": \"/rev\", \"value\": ", rev, " }, { \"op\": \"replace\", \"path\": \"/fields/System.IterationPath\", \"value\": \"ART SPS\" } ]");
|
||||
StringContent stringContent = new(json, Encoding.UTF8, "application/json-patch+json");
|
||||
string requestUri = string.Concat(basePage, api, $"/workitems/{id}?api-version=1.0");
|
||||
Task<HttpResponseMessage> httpResponseMessageTask = httpClient.PatchAsync(requestUri, stringContent);
|
||||
httpResponseMessageTask.Wait();
|
||||
if (!httpResponseMessageTask.Result.IsSuccessStatusCode)
|
||||
throw new Exception(httpResponseMessageTask.Result.StatusCode.ToString());
|
||||
Task<Stream> streamTask = httpResponseMessageTask.Result.Content.ReadAsStreamAsync();
|
||||
streamTask.Wait();
|
||||
if (!streamTask.Result.CanRead)
|
||||
throw new NullReferenceException(nameof(streamTask));
|
||||
JsonElement? result = JsonSerializer.Deserialize<JsonElement>(streamTask.Result);
|
||||
if (result is null || result.Value.ValueKind != JsonValueKind.Object)
|
||||
throw new NullReferenceException(nameof(result));
|
||||
}
|
||||
|
||||
private static void UpdateAllFeaturesNotArtSPS(HttpClient httpClient,
|
||||
string basePage,
|
||||
string api,
|
||||
ReadOnlyCollection<ValueWithReq> valueWithReqCollection)
|
||||
{
|
||||
foreach (ValueWithReq valueWithReq in valueWithReqCollection)
|
||||
{
|
||||
if (valueWithReq.Value.Fields.SystemIterationPath != "ART SPS\\2024")
|
||||
continue;
|
||||
UpdateIteration(httpClient, basePage, api, valueWithReq.Value.Id, valueWithReq.Value.Rev);
|
||||
}
|
||||
}
|
||||
|
||||
private static DateTime? GetCommitDate(FIBacklogMesa fiBacklogMesa)
|
||||
{
|
||||
DateTime? result;
|
||||
@ -587,6 +622,7 @@ internal static partial class Helper20240809
|
||||
int updated = SetSyncTag(httpClient, basePage, api, workItemTrackingHttpClient, assignedToNameToUser, requestorNameToUser, keyToFIBacklogMesa, valueWithReqCollection);
|
||||
if (updated == 0)
|
||||
{
|
||||
UpdateAllFeaturesNotArtSPS(httpClient, basePage, api, valueWithReqCollection);
|
||||
UpdateAllWorkItemsPharesComment(httpClient, basePage, api, sourceDirectory, keyToFIBacklogMesa, valueWithReqCollection);
|
||||
ReadOnlyCollection<ValueWithReq> extra = RemoveFrom(keyToFIBacklogMesa, valueWithReqCollection);
|
||||
foreach (KeyValuePair<string, FIBacklogMesa> keyValuePair in keyToFIBacklogMesa)
|
||||
|
Loading…
x
Reference in New Issue
Block a user