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

View File

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

View File

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

View File

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