additional cleanup of kanban utils.

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-01-08 17:32:20 -05:00
parent 0c7b5087f1
commit c6012f7335

View File

@@ -1,10 +1,10 @@
import _ from "lodash/";
import {groupBy} from "lodash";
const sortByParentId = (arr) => {
// return arr.reduce((accumulator, currentValue) => {
// //Find the parent item.
// let item = accumulator.find((x) => x.id === currentValue.kanbanparent);
// //Get index of praent item
// //Get index of parent item
// let index = accumulator.indexOf(item);
// index = index !== -1 ? index + 1 : 0;
@@ -12,9 +12,9 @@ const sortByParentId = (arr) => {
// return accumulator;
// }, []);
var parentId = "-1";
var sortedList = [];
var byParentsIdsList = _.groupBy(arr, "kanbanparent"); // Create a new array with objects indexed by parentId
let parentId = "-1";
const sortedList = [];
const byParentsIdsList = groupBy(arr, "kanbanparent"); // Create a new array with objects indexed by parentId
//console.log("sortByParentId -> byParentsIdsList", byParentsIdsList);
while (byParentsIdsList[parentId]) {
@@ -40,8 +40,7 @@ const sortByParentId = (arr) => {
};
export const createBoardData = (AllStatuses, Jobs, filter) => {
const { search, employeeId } = filter;
console.log("==========GENERATING BOARD DATA=============");
const {search, employeeId} = filter;
const boardLanes = {
columns: AllStatuses.map((s) => {
return {
@@ -73,7 +72,7 @@ export const createBoardData = (AllStatuses, Jobs, filter) => {
return include;
});
const DataGroupedByStatus = _.groupBy(filteredJobs, (d) => d.status);
const DataGroupedByStatus = groupBy(filteredJobs, (d) => d.status);
Object.keys(DataGroupedByStatus).map((statusGroupKey) => {
try {