Spacing in Poll value

This commit is contained in:
Mike Phares 2024-10-17 18:07:35 -07:00
parent c0fdbad707
commit 7c8a296fb3
4 changed files with 136 additions and 92 deletions

View File

@ -75,26 +75,37 @@ function getPriority(workItemType, priority) {
return result;
}
function getPollValue(priority, pollValue) {
function getInversePriority(priority) {
var result;
if (pollValue === undefined || pollValue.Records.length === undefined || pollValue.Records.length === 0)
result = priority;
else {
if (pollValue.Average !== null)
result = priority;
if (pollValue.Average > 2)
result = `${pollValue.Average}-1-${pollValue.Count}-High (Most Critical)`;
else if (pollValue.Average > 1)
result = `${pollValue.Average}-2-${pollValue.Count}-Medium`;
else if (pollValue.Average > 0)
result = `${pollValue.Average}-3-${pollValue.Count}-Low`;
else
result = priority;
}
if (priority == null || priority === 0)
result = "0.000";
else if (priority === 1)
result = "3.000";
else if (priority === 2)
result = "2.000";
else if (priority === 3)
result = "1.000";
else
result = "0.000";
return result;
}
function getWorkItems(data, dataB) {
function getPollValue(description, priority, priorityDisplay, pollValue) {
var result;
if (pollValue === undefined || pollValue.Records.length === undefined || pollValue.Records.length === 0 || pollValue.Average === null)
result = getInversePriority(priority) + ' - ' + priorityDisplay + ' - *Priority';
else if (pollValue.Average > 2)
result = `${pollValue.Average} - 1-High (Most ${description}) - ${pollValue.Count} Vote(s)`;
else if (pollValue.Average > 1)
result = `${pollValue.Average} - 2-Medium - ${pollValue.Count} Vote(s)`;
else if (pollValue.Average > 0)
result = `${pollValue.Average} - 3-Low - ${pollValue.Count} Vote(s)`;
else
result = getInversePriority(priority) + ' - ' + priorityDisplay + ' - *Priority';
return result;
}
function getWorkItems(data, dataB, description) {
var parent;
var workItem;
var workItems = [];
@ -103,7 +114,7 @@ function getWorkItems(data, dataB) {
workItem = data[i].WorkItem;
if (workItem.WorkItemType !== 'Feature')
continue;
if (workItem.IterationPath !== 'ART SPS')
if (workItem.State !== 'Active' && workItem.State !== 'New')
continue;
if (workItem.Tags != null && workItem.Tags.includes("Ignore"))
continue;
@ -119,10 +130,10 @@ function getWorkItems(data, dataB) {
workItem["ParentTitle"] = parent["Title"];
workItem["ParentState"] = getState(parent["State"]);
}
workItem["State"] = getState(workItem["State"])
var priority = getPriority(workItem["WorkItemType"], workItem["Priority"])
workItem["State"] = getState(workItem["State"]);
var priority = getPriority(workItem["WorkItemType"], workItem["Priority"]);
workItem["PollValue"] = getPollValue(description, workItem["Priority"], priority, dataB[workItem.Id]);
workItem["Priority"] = priority;
workItem["PollValue"] = getPollValue(priority, dataB[workItem.Id]);
workItems.push(workItem);
}
workItems.sort(compareFunction);
@ -142,7 +153,7 @@ function sendValue(element, page, id) {
function setWorkItems(workItems, page, description) {
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>Priority</th><th>Poll Value</th><th>Value</th><th>Up</th><th>Down</th></tr>";
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>State</th><th>Poll Value</th><th>Value</th><th>Up</th><th>Down</th></tr>";
const element = document.getElementById("HeaderGrid");
for (var i = 0; i < workItems.length; i++) {
record = workItems[i];
@ -153,7 +164,7 @@ function setWorkItems(workItems, page, description) {
"</td><td>" + record.Title +
"</td><td>" + record.AssignedTo +
"</td><td>" + record.Tags +
"</td><td>" + record.Priority +
"</td><td>" + record.State +
"</td><td>" + record.PollValue +
"</td><td>" +
'<select onchange="sendValue(this, \'' + page + '\', ' + record.Id + ')">' +
@ -187,7 +198,7 @@ function initIndex(url, apiUrl, page, description, urlB) {
updateSite();
$.getJSON(urlB, { _: new Date().getTime() }, function (dataB) {
$.getJSON(url, { _: new Date().getTime() }, function (data) {
var workItems = getWorkItems(data, dataB);
var workItems = getWorkItems(data, dataB, description);
console.log(data.length);
if (data.length > 0)
console.log(data[0]);

View File

@ -75,26 +75,37 @@ function getPriority(workItemType, priority) {
return result;
}
function getPollValue(priority, pollValue) {
function getInversePriority(priority) {
var result;
if (pollValue === undefined || pollValue.Records.length === undefined || pollValue.Records.length === 0)
result = priority;
else {
if (pollValue.Average !== null)
result = priority;
if (pollValue.Average > 2)
result = `${pollValue.Average}-1-${pollValue.Count}-High (Most Critical)`;
else if (pollValue.Average > 1)
result = `${pollValue.Average}-2-${pollValue.Count}-Medium`;
else if (pollValue.Average > 0)
result = `${pollValue.Average}-3-${pollValue.Count}-Low`;
else
result = priority;
}
if (priority == null || priority === 0)
result = "0.000";
else if (priority === 1)
result = "3.000";
else if (priority === 2)
result = "2.000";
else if (priority === 3)
result = "1.000";
else
result = "0.000";
return result;
}
function getWorkItems(data, dataB) {
function getPollValue(description, priority, priorityDisplay, pollValue) {
var result;
if (pollValue === undefined || pollValue.Records.length === undefined || pollValue.Records.length === 0 || pollValue.Average === null)
result = getInversePriority(priority) + ' - ' + priorityDisplay + ' - *Priority';
else if (pollValue.Average > 2)
result = `${pollValue.Average} - 1-High (Most ${description}) - ${pollValue.Count} Vote(s)`;
else if (pollValue.Average > 1)
result = `${pollValue.Average} - 2-Medium - ${pollValue.Count} Vote(s)`;
else if (pollValue.Average > 0)
result = `${pollValue.Average} - 3-Low - ${pollValue.Count} Vote(s)`;
else
result = getInversePriority(priority) + ' - ' + priorityDisplay + ' - *Priority';
return result;
}
function getWorkItems(data, dataB, description) {
var parent;
var workItem;
var workItems = [];
@ -103,7 +114,7 @@ function getWorkItems(data, dataB) {
workItem = data[i].WorkItem;
if (workItem.WorkItemType !== 'Feature')
continue;
if (workItem.IterationPath !== 'ART SPS')
if (workItem.State !== 'Active' && workItem.State !== 'New')
continue;
if (workItem.Tags != null && workItem.Tags.includes("Ignore"))
continue;
@ -119,10 +130,10 @@ function getWorkItems(data, dataB) {
workItem["ParentTitle"] = parent["Title"];
workItem["ParentState"] = getState(parent["State"]);
}
workItem["State"] = getState(workItem["State"])
var priority = getPriority(workItem["WorkItemType"], workItem["Priority"])
workItem["State"] = getState(workItem["State"]);
var priority = getPriority(workItem["WorkItemType"], workItem["Priority"]);
workItem["PollValue"] = getPollValue(description, workItem["Priority"], priority, dataB[workItem.Id]);
workItem["Priority"] = priority;
workItem["PollValue"] = getPollValue(priority, dataB[workItem.Id]);
workItems.push(workItem);
}
workItems.sort(compareFunction);
@ -142,7 +153,7 @@ function sendValue(element, page, id) {
function setWorkItems(workItems, page, description) {
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>Priority</th><th>Poll Value</th><th>Value</th><th>Up</th><th>Down</th></tr>";
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>State</th><th>Poll Value</th><th>Value</th><th>Up</th><th>Down</th></tr>";
const element = document.getElementById("HeaderGrid");
for (var i = 0; i < workItems.length; i++) {
record = workItems[i];
@ -153,7 +164,7 @@ function setWorkItems(workItems, page, description) {
"</td><td>" + record.Title +
"</td><td>" + record.AssignedTo +
"</td><td>" + record.Tags +
"</td><td>" + record.Priority +
"</td><td>" + record.State +
"</td><td>" + record.PollValue +
"</td><td>" +
'<select onchange="sendValue(this, \'' + page + '\', ' + record.Id + ')">' +
@ -187,7 +198,7 @@ function initIndex(url, apiUrl, page, description, urlB) {
updateSite();
$.getJSON(urlB, { _: new Date().getTime() }, function (dataB) {
$.getJSON(url, { _: new Date().getTime() }, function (data) {
var workItems = getWorkItems(data, dataB);
var workItems = getWorkItems(data, dataB, description);
console.log(data.length);
if (data.length > 0)
console.log(data[0]);

View File

@ -75,26 +75,37 @@ function getPriority(workItemType, priority) {
return result;
}
function getPollValue(priority, pollValue) {
function getInversePriority(priority) {
var result;
if (pollValue === undefined || pollValue.Records.length === undefined || pollValue.Records.length === 0)
result = priority;
else {
if (pollValue.Average !== null)
result = priority;
if (pollValue.Average > 2)
result = `${pollValue.Average}-1-${pollValue.Count}-High (Most Critical)`;
else if (pollValue.Average > 1)
result = `${pollValue.Average}-2-${pollValue.Count}-Medium`;
else if (pollValue.Average > 0)
result = `${pollValue.Average}-3-${pollValue.Count}-Low`;
else
result = priority;
}
if (priority == null || priority === 0)
result = "0.000";
else if (priority === 1)
result = "3.000";
else if (priority === 2)
result = "2.000";
else if (priority === 3)
result = "1.000";
else
result = "0.000";
return result;
}
function getWorkItems(data, dataB) {
function getPollValue(description, priority, priorityDisplay, pollValue) {
var result;
if (pollValue === undefined || pollValue.Records.length === undefined || pollValue.Records.length === 0 || pollValue.Average === null)
result = getInversePriority(priority) + ' - ' + priorityDisplay + ' - *Priority';
else if (pollValue.Average > 2)
result = `${pollValue.Average} - 1-High (Most ${description}) - ${pollValue.Count} Vote(s)`;
else if (pollValue.Average > 1)
result = `${pollValue.Average} - 2-Medium - ${pollValue.Count} Vote(s)`;
else if (pollValue.Average > 0)
result = `${pollValue.Average} - 3-Low - ${pollValue.Count} Vote(s)`;
else
result = getInversePriority(priority) + ' - ' + priorityDisplay + ' - *Priority';
return result;
}
function getWorkItems(data, dataB, description) {
var parent;
var workItem;
var workItems = [];
@ -103,7 +114,7 @@ function getWorkItems(data, dataB) {
workItem = data[i].WorkItem;
if (workItem.WorkItemType !== 'Feature')
continue;
if (workItem.IterationPath !== 'ART SPS')
if (workItem.State !== 'Active' && workItem.State !== 'New')
continue;
if (workItem.Tags != null && workItem.Tags.includes("Ignore"))
continue;
@ -119,10 +130,10 @@ function getWorkItems(data, dataB) {
workItem["ParentTitle"] = parent["Title"];
workItem["ParentState"] = getState(parent["State"]);
}
workItem["State"] = getState(workItem["State"])
var priority = getPriority(workItem["WorkItemType"], workItem["Priority"])
workItem["State"] = getState(workItem["State"]);
var priority = getPriority(workItem["WorkItemType"], workItem["Priority"]);
workItem["PollValue"] = getPollValue(description, workItem["Priority"], priority, dataB[workItem.Id]);
workItem["Priority"] = priority;
workItem["PollValue"] = getPollValue(priority, dataB[workItem.Id]);
workItems.push(workItem);
}
workItems.sort(compareFunction);
@ -142,7 +153,7 @@ function sendValue(element, page, id) {
function setWorkItems(workItems, page, description) {
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>Priority</th><th>Poll Value</th><th>Value</th><th>Up</th><th>Down</th></tr>";
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>State</th><th>Poll Value</th><th>Value</th><th>Up</th><th>Down</th></tr>";
const element = document.getElementById("HeaderGrid");
for (var i = 0; i < workItems.length; i++) {
record = workItems[i];
@ -153,7 +164,7 @@ function setWorkItems(workItems, page, description) {
"</td><td>" + record.Title +
"</td><td>" + record.AssignedTo +
"</td><td>" + record.Tags +
"</td><td>" + record.Priority +
"</td><td>" + record.State +
"</td><td>" + record.PollValue +
"</td><td>" +
'<select onchange="sendValue(this, \'' + page + '\', ' + record.Id + ')">' +
@ -187,7 +198,7 @@ function initIndex(url, apiUrl, page, description, urlB) {
updateSite();
$.getJSON(urlB, { _: new Date().getTime() }, function (dataB) {
$.getJSON(url, { _: new Date().getTime() }, function (data) {
var workItems = getWorkItems(data, dataB);
var workItems = getWorkItems(data, dataB, description);
console.log(data.length);
if (data.length > 0)
console.log(data[0]);

View File

@ -75,26 +75,37 @@ function getPriority(workItemType, priority) {
return result;
}
function getPollValue(priority, pollValue) {
function getInversePriority(priority) {
var result;
if (pollValue === undefined || pollValue.Records.length === undefined || pollValue.Records.length === 0)
result = priority;
else {
if (pollValue.Average !== null)
result = priority;
if (pollValue.Average > 2)
result = `${pollValue.Average}-1-${pollValue.Count}-High (Most Critical)`;
else if (pollValue.Average > 1)
result = `${pollValue.Average}-2-${pollValue.Count}-Medium`;
else if (pollValue.Average > 0)
result = `${pollValue.Average}-3-${pollValue.Count}-Low`;
else
result = priority;
}
if (priority == null || priority === 0)
result = "0.000";
else if (priority === 1)
result = "3.000";
else if (priority === 2)
result = "2.000";
else if (priority === 3)
result = "1.000";
else
result = "0.000";
return result;
}
function getWorkItems(data, dataB) {
function getPollValue(description, priority, priorityDisplay, pollValue) {
var result;
if (pollValue === undefined || pollValue.Records.length === undefined || pollValue.Records.length === 0 || pollValue.Average === null)
result = getInversePriority(priority) + ' - ' + priorityDisplay + ' - *Priority';
else if (pollValue.Average > 2)
result = `${pollValue.Average} - 1-High (Most ${description}) - ${pollValue.Count} Vote(s)`;
else if (pollValue.Average > 1)
result = `${pollValue.Average} - 2-Medium - ${pollValue.Count} Vote(s)`;
else if (pollValue.Average > 0)
result = `${pollValue.Average} - 3-Low - ${pollValue.Count} Vote(s)`;
else
result = getInversePriority(priority) + ' - ' + priorityDisplay + ' - *Priority';
return result;
}
function getWorkItems(data, dataB, description) {
var parent;
var workItem;
var workItems = [];
@ -103,7 +114,7 @@ function getWorkItems(data, dataB) {
workItem = data[i].WorkItem;
if (workItem.WorkItemType !== 'Feature')
continue;
if (workItem.IterationPath !== 'ART SPS')
if (workItem.State !== 'Active' && workItem.State !== 'New')
continue;
if (workItem.Tags != null && workItem.Tags.includes("Ignore"))
continue;
@ -119,10 +130,10 @@ function getWorkItems(data, dataB) {
workItem["ParentTitle"] = parent["Title"];
workItem["ParentState"] = getState(parent["State"]);
}
workItem["State"] = getState(workItem["State"])
var priority = getPriority(workItem["WorkItemType"], workItem["Priority"])
workItem["State"] = getState(workItem["State"]);
var priority = getPriority(workItem["WorkItemType"], workItem["Priority"]);
workItem["PollValue"] = getPollValue(description, workItem["Priority"], priority, dataB[workItem.Id]);
workItem["Priority"] = priority;
workItem["PollValue"] = getPollValue(priority, dataB[workItem.Id]);
workItems.push(workItem);
}
workItems.sort(compareFunction);
@ -142,7 +153,7 @@ function sendValue(element, page, id) {
function setWorkItems(workItems, page, description) {
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>Priority</th><th>Poll Value</th><th>Value</th><th>Up</th><th>Down</th></tr>";
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>State</th><th>Poll Value</th><th>Value</th><th>Up</th><th>Down</th></tr>";
const element = document.getElementById("HeaderGrid");
for (var i = 0; i < workItems.length; i++) {
record = workItems[i];
@ -153,7 +164,7 @@ function setWorkItems(workItems, page, description) {
"</td><td>" + record.Title +
"</td><td>" + record.AssignedTo +
"</td><td>" + record.Tags +
"</td><td>" + record.Priority +
"</td><td>" + record.State +
"</td><td>" + record.PollValue +
"</td><td>" +
'<select onchange="sendValue(this, \'' + page + '\', ' + record.Id + ')">' +
@ -187,7 +198,7 @@ function initIndex(url, apiUrl, page, description, urlB) {
updateSite();
$.getJSON(urlB, { _: new Date().getTime() }, function (dataB) {
$.getJSON(url, { _: new Date().getTime() }, function (data) {
var workItems = getWorkItems(data, dataB);
var workItems = getWorkItems(data, dataB, description);
console.log(data.length);
if (data.length > 0)
console.log(data[0]);