ParentCoD
This commit is contained in:
@ -75,10 +75,42 @@ function getPriority(workItemType, priority) {
|
||||
return result;
|
||||
}
|
||||
|
||||
function getWorkItems(data) {
|
||||
function updateRecordCoD(workItem) {
|
||||
if (workItem === null || workItem["RiskReductionMinusOpportunityEnablement"] === null || workItem["TimeCriticality"] === null || workItem["BusinessValue"] === null)
|
||||
workItem["CoD"] === 0;
|
||||
else
|
||||
workItem["CoD"] === workItem["RiskReductionMinusOpportunityEnablement"] + workItem["TimeCriticality"] + workItem["BusinessValue"];
|
||||
}
|
||||
|
||||
function updateRecordWSJF(workItem) {
|
||||
if (workItem["WeightedShortestJobFirst"] === null)
|
||||
workItem["WeightedShortestJobFirst"] = 9999999;
|
||||
}
|
||||
|
||||
function updateRecordOther(workItem) {
|
||||
workItem["State"] = getState(workItem["State"]);
|
||||
workItem["Priority"] = getPriority(workItem["WorkItemType"], workItem["Priority"]);
|
||||
}
|
||||
|
||||
function updateRecordParent(parent, workItem) {
|
||||
if (parent === null) {
|
||||
workItem["ParentId"] = 9999999;
|
||||
workItem["ParentTitle"] = null;
|
||||
workItem["ParentState"] = null;
|
||||
workItem["ParentCoD"] = 9999999;
|
||||
}
|
||||
else {
|
||||
workItem["ParentId"] = parent["Id"];
|
||||
workItem["ParentCoD"] = parent["CoD"];
|
||||
workItem["ParentTitle"] = parent["Title"];
|
||||
workItem["ParentState"] = getState(parent["State"]);
|
||||
}
|
||||
}
|
||||
|
||||
function getRecords(data) {
|
||||
var parent;
|
||||
var workItem;
|
||||
var workItems = [];
|
||||
var records = [];
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
parent = data[i].Parent;
|
||||
workItem = data[i].WorkItem;
|
||||
@ -88,27 +120,18 @@ function getWorkItems(data) {
|
||||
continue;
|
||||
if ((window.location.href.indexOf('=LEO') > -1 && workItem.AreaPath !== 'ART SPS\\LEO') || (window.location.href.indexOf('=MES') > -1 && workItem.AreaPath !== 'ART SPS\\MES'))
|
||||
continue;
|
||||
if (workItem["WeightedShortestJobFirst"] === null)
|
||||
workItem["WeightedShortestJobFirst"] = 9999999;
|
||||
if (parent === null) {
|
||||
workItem["ParentId"] = 9999999;
|
||||
workItem["ParentTitle"] = null;
|
||||
workItem["ParentState"] = null;
|
||||
}
|
||||
else {
|
||||
workItem["ParentId"] = parent["Id"];
|
||||
workItem["ParentTitle"] = parent["Title"];
|
||||
workItem["ParentState"] = getState(parent["State"]);
|
||||
}
|
||||
workItem["State"] = getState(workItem["State"])
|
||||
workItem["Priority"] = getPriority(workItem["WorkItemType"], workItem["Priority"])
|
||||
workItems.push(workItem);
|
||||
updateRecordCoD(parent);
|
||||
updateRecordCoD(workItem);
|
||||
updateRecordWSJF(workItem);
|
||||
updateRecordOther(workItem);
|
||||
updateRecordParent(parent, workItem);
|
||||
records.push(workItem);
|
||||
}
|
||||
workItems.sort(compareFunction);
|
||||
return workItems;
|
||||
records.sort(compareFunction);
|
||||
return records;
|
||||
}
|
||||
|
||||
function setWorkItems(workItems) {
|
||||
function setRecords(workItems) {
|
||||
var record;
|
||||
var 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>WSJF</th><th>Value</th><th>Up</th><th>Down</th></tr>";
|
||||
const element = document.getElementById("HeaderGrid");
|
||||
@ -147,11 +170,11 @@ function initIndex(url, apiUrl) {
|
||||
_apiUrl = apiUrl;
|
||||
updateSite();
|
||||
$.getJSON(url, { _: new Date().getTime() }, function (data) {
|
||||
var workItems = getWorkItems(data);
|
||||
var records = getRecords(data);
|
||||
console.log(data.length);
|
||||
if (data.length > 0)
|
||||
console.log(data[0]);
|
||||
setWorkItems(workItems);
|
||||
setRecords(records);
|
||||
$(".up,.down").click(function () {
|
||||
var row = $(this).parents("tr:first");
|
||||
if ($(this).is(".up")) {
|
||||
|
Reference in New Issue
Block a user