diff --git a/Adaptation/FileHandlers/json/StaticSite/js/cod-1-123-0-.ts b/Adaptation/FileHandlers/json/StaticSite/js/cod-1-123-0-.ts index 4cb485e..4324fc9 100644 --- a/Adaptation/FileHandlers/json/StaticSite/js/cod-1-123-0-.ts +++ b/Adaptation/FileHandlers/json/StaticSite/js/cod-1-123-0-.ts @@ -13,16 +13,32 @@ var _machineId = ''; var _sessionId = ''; var _windowLocationHRef = ''; -function compareFunctionSortOrder(a: any, b: any) { - return a.SortOrder - b.SortOrder; +function compareFunctionEffort(a: any, b: any) { + if (a.Effort == undefined || a.Effort === ' ') { + return -1; + } + if (b.Effort !== a.Effort) { + return b.Effort - a.Effort; + } + return b.WeightedShortestJobFirst - a.WeightedShortestJobFirst; } -function compareFunctionParentId(a: any, b: any) { - return a.ParentId - b.ParentId || a.Id - b.Id; +function compareFunctionSortOrder(a: any, b: any) { + if (a.SortOrder == undefined || a.SortOrder === ' ') { + return -1; + } + return a.SortOrder - b.SortOrder } function compareFunctionWeightedShortestJobFirst(a: any, b: any) { - if (b.WeightedShortestJobFirst === ' ') { + if (b.WeightedShortestJobFirst == undefined || b.WeightedShortestJobFirst === ' ') { + return -1; + } + return b.WeightedShortestJobFirst - a.WeightedShortestJobFirst; +} + +function compareFunctionWeightedShortestJobFirstNullFirst(a: any, b: any) { + if (a.WeightedShortestJobFirst == undefined || a.WeightedShortestJobFirst === ' ') { return -1; } return b.WeightedShortestJobFirst - a.WeightedShortestJobFirst; @@ -300,14 +316,17 @@ function getRecords(b: any, r: any, t: any, c: any, e: any, w: any, data: any, d workItem.State = getState(workItem.State); records.push(workItem); } - if (_windowLocationHRef.indexOf('=WSJF') > -1) { - records.sort(compareFunctionWeightedShortestJobFirst); + if (_windowLocationHRef.indexOf('=EFFORT') > -1) { + records.sort(compareFunctionEffort); } else if (_windowLocationHRef.indexOf('=LIVE') > -1) { records.sort(compareFunctionSortOrder); } + else if (_windowLocationHRef.indexOf('=WSJF') > -1) { + records.sort(compareFunctionWeightedShortestJobFirst); + } else { - records.sort(compareFunctionParentId); + records.sort(compareFunctionWeightedShortestJobFirstNullFirst); } return records; } diff --git a/Adaptation/FileHandlers/json/StaticSite/js/cod-1-123-0.js b/Adaptation/FileHandlers/json/StaticSite/js/cod-1-123-0.js index a7b54ca..6af2774 100644 --- a/Adaptation/FileHandlers/json/StaticSite/js/cod-1-123-0.js +++ b/Adaptation/FileHandlers/json/StaticSite/js/cod-1-123-0.js @@ -13,16 +13,29 @@ var _machineId = ''; var _sessionId = ''; var _windowLocationHRef = ''; -function compareFunctionSortOrder(a, b) { - return a.SortOrder - b.SortOrder; +function compareFunctionEffort(a, b) { + if (a.Effort == undefined || a.Effort === ' ') { + return -1; + } + if (b.Effort !== a.Effort) { + return b.Effort - a.Effort; + } + return b.WeightedShortestJobFirst - a.WeightedShortestJobFirst; } -function compareFunctionParentId(a, b) { - return a.ParentId - b.ParentId || a.Id - b.Id; +function compareFunctionSortOrder(a, b) { + return a.SortOrder - b.SortOrder } function compareFunctionWeightedShortestJobFirst(a, b) { - if (b.WeightedShortestJobFirst === ' ') { + if (b.WeightedShortestJobFirst == undefined || b.WeightedShortestJobFirst === ' ') { + return -1; + } + return b.WeightedShortestJobFirst - a.WeightedShortestJobFirst; +} + +function compareFunctionWeightedShortestJobFirstNullFirst(a, b) { + if (a.WeightedShortestJobFirst == undefined || a.WeightedShortestJobFirst === ' ') { return -1; } return b.WeightedShortestJobFirst - a.WeightedShortestJobFirst; @@ -289,14 +302,17 @@ function getRecords(b, r, t, c, e, w, data, dataB, workItems) { workItem.State = getState(workItem.State); records.push(workItem); } - if (_windowLocationHRef.indexOf('=WSJF') > -1) { - records.sort(compareFunctionWeightedShortestJobFirst); + if (_windowLocationHRef.indexOf('=EFFORT') > -1) { + records.sort(compareFunctionEffort); } else if (_windowLocationHRef.indexOf('=LIVE') > -1) { records.sort(compareFunctionSortOrder); } + else if (_windowLocationHRef.indexOf('=WSJF') > -1) { + records.sort(compareFunctionWeightedShortestJobFirst); + } else { - records.sort(compareFunctionParentId); + records.sort(compareFunctionWeightedShortestJobFirstNullFirst); } return records; } @@ -445,17 +461,17 @@ function updateSite(c, w) { document.title = document.title.replace('Infineon', 'Infineon'); document.getElementById('siteHeader').innerText = 'Infineon'; } - if (_windowLocationHRef.indexOf('=WSJF') > -1) { - document.getElementById('th-span').innerHTML = w.th + ' sorted by WSJF'; + if (_windowLocationHRef.indexOf('=EFFORT') > -1) { + document.getElementById('th-span').innerHTML = c.th + ' sorted by Effort (null, highest, ..., lowest)'; } else if (_windowLocationHRef.indexOf('=LIVE') > -1) { - document.getElementById('th-span').innerHTML = c.th + ' sorted by CoD'; + document.getElementById('th-span').innerHTML = c.th + ' Live View'; } - else if (_windowLocationHRef.indexOf('=EFFORT') > -1) { - document.getElementById('th-span').innerHTML = c.th + ' sorted by Parent Id'; + else if (_windowLocationHRef.indexOf('=WSJF') > -1) { + document.getElementById('th-span').innerHTML = w.th + ' sorted by WSJF (highest, ..., lowest, null)'; } else { - document.getElementById('th-span').innerHTML = c.th + ' sorted by Parent Id'; + document.getElementById('th-span').innerHTML = c.th + ' sorted by WSJF (null, highest, ..., lowest)'; } }