Enhance JSON deserialization and file associations; refactor ProcessData classes for improved clarity and performance

This commit is contained in:
2025-10-16 23:29:26 -07:00
parent 68c3a8b5f3
commit d9cf8d2aae
11 changed files with 149 additions and 44 deletions

View File

@ -150,6 +150,11 @@ function updateRecordCoD(b: any, r: any, t: any, c: any, e: any, w: any, workIte
}
}
if (workItem.Id === 330178) {
if (weightedShortestJobFirst != weightedShortestJobFirstFibonacci) {
}
}
workItem.CumulativeStoryPoints = ' ';
workItem.TotalStoryPoints = totalStoryPoints + ' User Story Point(s)';
workItem.AbsoluteDelta = data.Effort == undefined || data.Effort.FibonacciAverage == undefined || totalStoryPoints == undefined || totalStoryPoints === 0 ? ' ' : round(Math.abs(data.Effort.FibonacciAverage - ((totalStoryPoints / highestTotalStoryPoints) * 5)), 1);
@ -165,17 +170,30 @@ function updateRecordCoD(b: any, r: any, t: any, c: any, e: any, w: any, workIte
workItem.TimeCriticalityNotifications = data.TimeCriticality == undefined ? ' ' : getNotifications(t, data.TimeCriticality);
workItem.RiskReductionMinusOpportunityEnablementNotifications = data.RiskReductionOpportunityEnablement == undefined ? ' ' : getNotifications(r, data.RiskReductionOpportunityEnablement);
workItem.SortOrder = data.SortOrder == undefined ? 0 : data.SortOrder;
let check = effort == workItem.Effort
&& businessValue === workItem.BusinessValue
&& timeCriticality === workItem.TimeCriticality
&& riskReductionMinusOpportunityEnablement === workItem.RiskReductionMinusOpportunityEnablement;
if (check && weightedShortestJobFirst == workItem.WeightedShortestJobFirst) {
if (workItem.Effort == undefined ||
workItem.BusinessValue == undefined ||
workItem.TimeCriticality == undefined ||
workItem.RiskReductionMinusOpportunityEnablement == undefined ||
workItem.WeightedShortestJobFirst == undefined ||
workItem.Effort == ' ' ||
workItem.BusinessValue == ' ' ||
workItem.TimeCriticality == ' ' ||
workItem.RiskReductionMinusOpportunityEnablement == ' ' ||
workItem.WeightedShortestJobFirst == ' ') {
workItem.api = '';
} else {
workItem.api = `
### Work Item Patch ${check} WSJF ${workItem.Id} ${weightedShortestJobFirst} != ${workItem.WeightedShortestJobFirst}
}
else {
let check = effort === workItem.Effort
&& businessValue === workItem.BusinessValue
&& timeCriticality === workItem.TimeCriticality
&& riskReductionMinusOpportunityEnablement === workItem.RiskReductionMinusOpportunityEnablement;
if (check && weightedShortestJobFirst == workItem.WeightedShortestJobFirst) {
workItem.api = '';
} else {
workItem.api = `
### Work Item Patch ${check} WSJF ${workItem.Id} ${effort}:${workItem.Effort}; ${businessValue}:${workItem.BusinessValue}; ${timeCriticality}:${workItem.TimeCriticality}; ${riskReductionMinusOpportunityEnablement}:${workItem.RiskReductionMinusOpportunityEnablement}; ${weightedShortestJobFirst}:${workItem.WeightedShortestJobFirst};
patch {{Factory-Integration}}/_apis/wit/workitems/${workItem.Id}?api-version=7.0
PATCH https://tfs.intra.infineon.com/tfs/FactoryIntegration/_apis/wit/workitems/${workItem.Id}?api-version=7.0
Authorization: Basic {{PAT}}
Content-Type: application/json-patch+json
@ -222,6 +240,7 @@ jsonpath "$.fields['Custom.RRminusOE']" == ${workItem.RiskReductionMinusOpportun
jsonpath "$.fields['Microsoft.VSTS.Common.TimeCriticality']" == ${workItem.TimeCriticality}
jsonpath "$.fields['Custom.WSJF']" == ${workItem.WeightedShortestJobFirst}
jsonpath "$.fields['Custom.WSJFFib']" == ${workItem.WeightedShortestJobFirst}`;
}
}
}
}
@ -295,10 +314,19 @@ function getRecords(b: any, r: any, t: any, c: any, e: any, w: any, data: any, d
function getHtmlTextAndApi(fromHtml: any, b: any, r: any, t: any, c: any, e: any, w: any, records: any) {
let record;
let api = '';
let lineA = '';
let lineB = '';
let lineC = '';
let api = `
### FactoryIntegration (hurl.exe)
GET https://tfs.intra.infineon.com/tfs/FactoryIntegration
HTTP 401
[Asserts]
duration < 12345
`;
let text = 'Id\tRisk Reduction and/or Opportunity Enablement\tTime Criticality\tBusiness Value\tEffort\tWSJF\tCoD\tFeature Total Story Points\tAbsolute Delta\tState\tRequester\tAssigned To\tIteration Path\tSystem\tTitle-123\r\n';
let html = '<tr><th>Parent Id</th><th>Parent Title</th><th>Id</th><th>Requester</th><th>Title</th><th>Assigned To</th><th>System(s)</th><th>State</th><th>Priority</th><th>Risk Reduction and/or Opportunity Enablement</th><th>Time Criticality</th><th>Business Value</th><th>Cost of Delay (CoD)</th><th>Effort</th><th>WSJF</th></tr>';
for (let i = 0; i < records.length; i++) {
@ -379,7 +407,7 @@ function getHtmlTextAndApi(fromHtml: any, b: any, r: any, t: any, c: any, e: any
console.log(text);
html += lineA + lineB + lineC;
}
return { html, text, http: api };
return { html, text, api };
}
const username = '';