IO-3515 resolve issues on search selects not updating, improve confidence scoring.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Progress, Tag, Tooltip } from "antd";
|
||||
import { Progress, Space, Tag, Tooltip } from "antd";
|
||||
import { useTranslation } from "react-i18next";
|
||||
const parseConfidence = (confidenceStr) => {
|
||||
if (!confidenceStr || typeof confidenceStr !== "string") return null;
|
||||
@@ -20,10 +20,11 @@ const getConfidenceColor = (value) => {
|
||||
return "red";
|
||||
};
|
||||
|
||||
const ConfidenceDisplay = ({ value }) => {
|
||||
const ConfidenceDisplay = ({ rowValue: { confidence, actual_price, actual_cost } }) => {
|
||||
const { t } = useTranslation();
|
||||
const parsed = parseConfidence(value);
|
||||
|
||||
const parsed = parseConfidence(confidence);
|
||||
const parsed_actual_price = parseFloat(actual_price);
|
||||
const parsed_actual_cost = parseFloat(actual_cost);
|
||||
if (!parsed) {
|
||||
return <span style={{ color: "#999", fontSize: "0.85em" }}>N/A</span>;
|
||||
}
|
||||
@@ -71,9 +72,16 @@ const ConfidenceDisplay = ({ value }) => {
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<Tag color={color} style={{ margin: 0, cursor: "help", userSelect: "none" }}>
|
||||
{total.toFixed(0)}%
|
||||
</Tag>
|
||||
<Space size="small">
|
||||
{!parsed_actual_cost || !parsed_actual_price || parsed_actual_cost === 0 || parsed_actual_price === 0 ? (
|
||||
<Tag color="red" style={{ margin: 0, cursor: "help", userSelect: "none" }}>
|
||||
{t("billlines.confidence.missing_data", { defaultValue: "Missing Data" })}
|
||||
</Tag>
|
||||
) : null}
|
||||
<Tag color={color} style={{ margin: 0, cursor: "help", userSelect: "none" }}>
|
||||
{total.toFixed(0)}%
|
||||
</Tag>
|
||||
</Space>
|
||||
</Tooltip>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user