Resolve issue for vehicles under 20000km.

This commit is contained in:
Patrick Fic
2024-08-16 14:33:38 -07:00
parent 1895adb9ea
commit 5e2f7dc098
4 changed files with 17 additions and 14 deletions

View File

@@ -1,14 +1,13 @@
import { CloudUploadOutlined, WarningOutlined } from "@ant-design/icons";
import { Alert, Input, Space, Table, Tooltip } from "antd";
import dayjs from "../../../util/day.js";
import React, { useState } from "react";
import { useMemo } from "react";
import { CloudUploadOutlined } from "@ant-design/icons";
import { Alert, Input, Space, Table } from "antd";
import React, { useMemo, useState } from "react";
import { connect } from "react-redux";
import { Link } from "react-router-dom";
import { createStructuredSelector } from "reselect";
import ipcTypes from "../../../ipc.types";
import { setSelectedJobId } from "../../../redux/application/application.actions";
import { selectReportData, selectReportLoading, selectScorecard } from "../../../redux/reporting/reporting.selectors";
import dayjs from "../../../util/day.js";
import { alphaSort } from "../../../util/sorters";
import VehicleGroupAlertAtom from "../../atoms/vehicle-group-alert/vehicle-group-alert.atom";
import GroupVerifySwitch from "../group-verify-switch/group-verify-switch.component";
@@ -111,11 +110,11 @@ export function ReportingJobsListMolecule({ scoreCard, reportingLoading, reportD
}}
>
{`${record.jobRpsDollars.toFormat()} / ${record.expectedRpsDollars.toFormat()}`}
{record.v_mileage < 20000 && (
{/* {record.v_mileage < 20000 && (
<Tooltip title="Vehicle is under 20,000 KMs. No expected savings.">
<WarningOutlined style={{ color: "seagreen" }} />
</Tooltip>
)}
)} */}
</Space>
)
},

View File

@@ -21,17 +21,16 @@ export default function GetJobTarget({ group, v_age, targets, close_date, v_mile
// console.log("Result:", 1);
// }
//V3 Check - If vehicle is less than 20,000KM, there is NO TARGET.
if (v_mileage && v_mileage <= 20000) {
return 0;
}
//V2 Check
const newTargets = store.getState().user.targets;
const rulesToApply = WhichRulesetToApply(close_date);
if (rulesToApply === "V3") {
const v3Target = V3TargetAndGroupFinder(job)
//V3 Check - If vehicle is less than 20,000KM, there is NO TARGET.
if (v_mileage && v_mileage <= 20000) {
return 0;
}
const v3Target = V3TargetAndGroupFinder(job);
return v3Target?.target || 0.023;
} else {
const newTargetsForGroup = newTargets.filter((t) => t.name === rulesToApply && t.group === group);