@@ -2,7 +2,7 @@ import React, { useMemo } from "react";
|
||||
import { Card, Statistic } from "antd";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import PropTypes from "prop-types";
|
||||
import { statisticsItems } from "./defaultKanbanSettings.js";
|
||||
import { statisticsItems } from "./settings/defaultKanbanSettings.js";
|
||||
|
||||
export const StatisticType = {
|
||||
HOURS: "hours",
|
||||
@@ -152,15 +152,15 @@ const ProductionStatistics = ({ data, cardSettings, reducerData }) => {
|
||||
);
|
||||
|
||||
const sortedStatistics = useMemo(() => {
|
||||
const sorted = [];
|
||||
cardSettings.statisticsOrder.forEach((orderId) => {
|
||||
const value = statistics.find((stat) => stat.id === orderId);
|
||||
if (value.value !== null) {
|
||||
const statisticsMap = new Map(statistics.map((stat) => [stat.id, stat]));
|
||||
|
||||
return cardSettings.statisticsOrder.reduce((sorted, orderId) => {
|
||||
const value = statisticsMap.get(orderId);
|
||||
if (value && value.value !== null) {
|
||||
sorted.push(value);
|
||||
}
|
||||
});
|
||||
|
||||
return sorted;
|
||||
return sorted;
|
||||
}, []);
|
||||
}, [statistics, cardSettings.statisticsOrder]);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user