Refactor decoder to use group name for v3 targets. 1.3.2-alpha.1 release.

This commit is contained in:
Patrick Fic
2024-09-05 13:38:10 -07:00
parent 6467078505
commit fa43424878
7 changed files with 65 additions and 26 deletions

View File

@@ -448,7 +448,7 @@ function V1Ruleset(jobline, joblines) {
jobline.line_desc.toLowerCase().startsWith("urethane") ||
jobline.line_desc.toLowerCase().startsWith("w/shield adhesive") ||
//jobline.line_desc.toLowerCase().includes("wheel") || Removed as a part of RPS-41
(jobline.line_desc.toLowerCase().includes("tire") && !jobline.line_desc.toLowerCase().includes("sensor")) ||
(jobline.line_desc.toLowerCase().includes("tire") && !jobline.line_desc.toLowerCase().includes("sensor")&& !jobline.line_desc.toLowerCase().includes("label")) ||
jobline.line_desc.toLowerCase().startsWith("hazardous") ||
jobline.line_desc.toLowerCase().startsWith("detail") ||
jobline.line_desc.toLowerCase().startsWith("clean") ||

View File

@@ -3,7 +3,7 @@
"productName": "ImEX RPS",
"author": "ImEX Systems Inc. <support@thinkimex.com>",
"description": "ImEX RPS",
"version": "1.3.2",
"version": "1.3.2-alpha.1",
"main": "electron/main.js",
"homepage": "./",
"dependencies": {

View File

@@ -50,20 +50,21 @@ export function JobGroupMolecule({ bodyshop, jobId, group, job }) {
RulesetToApply === "V3" ? (
<Menu
onClick={handleMenuClick}
disabled
//disabled
items={[
{ label: "Group 1", value: "Group 1" },
{ label: "Group 2", value: "Group 2" },
{ label: "Group 3", value: "Group 3" },
{ label: "Group 4", value: "Group 4" },
{ label: "Group 5", value: "Group 5" },
{ label: "Group 6", value: "Group 6" },
{ label: "Group 7", value: "Group 7" },
{ label: "Group 8", value: "Group 8" },
{ label: "Group 9", value: "Group 9" },
{ label: "Group 10", value: "Group 10" },
{ label: "Group 11", value: "Group 11" },
{ label: "Group 12", value: "Group 12" }
{ label: "Group 1", key: "Group 1", value: "Group 1" },
{ label: "Group 2", key: "Group 2", value: "Group 2" },
{ label: "Group 3", key: "Group 3", value: "Group 3" },
{ label: "Group 4", key: "Group 4", value: "Group 4" },
{ label: "Group 5", key: "Group 5", value: "Group 5" },
{ label: "Group 6", key: "Group 6", value: "Group 6" },
{ label: "Group 7", key: "Group 7", value: "Group 7" },
{ label: "Group 8", key: "Group 8", value: "Group 8" },
{ label: "Group 9", key: "Group 9", value: "Group 9" },
{ label: "Group 10", key: "Group 10", value: "Group 10" },
{ label: "Group 11", key: "Group 11", value: "Group 11" },
{ label: "Group 12", key: "Group 12", value: "Group 12" },
{ label: "Default", key: "Default", value: "Default" }
]}
></Menu>
) : (
@@ -72,7 +73,10 @@ export function JobGroupMolecule({ bodyshop, jobId, group, job }) {
return (
<Space align="top">
<Dropdown overlay={menu} disabled={RulesetToApply === "V3"} trigger={["click"]}>
<Dropdown
overlay={menu} //disabled={RulesetToApply === "V3"}
trigger={["click"]}
>
<a href=" #" onClick={(e) => e.preventDefault()}>
{group}
<DownOutlined style={{ marginLeft: ".2rem" }} />

View File

@@ -2,7 +2,7 @@ import { Modal, List, Card, Input, Row, Col, Table } from "antd";
import _ from "lodash";
import React, { useState } from "react";
import { InfoCircleFilled } from "@ant-design/icons";
import { FakedTargetsForV3WithMake } from "../../../ipc/ipc-estimate-utils";
import { FakedGroupsForV3WithMake } from "../../../ipc/ipc-estimate-utils";
import { WhichRulesetToApply } from "../../../util/constants";
import { alphaSort } from "../../../util/sorters";
@@ -359,7 +359,7 @@ export function JobsGroupPreV3ModalMolecule() {
}
const v3DataSource = _.sortBy(
FakedTargetsForV3WithMake.filter((f) => (f.name = "V3")),
FakedGroupsForV3WithMake.filter((f) => (f.name = "V3")),
"make"
);

View File

@@ -202,13 +202,13 @@ const generateRemoveQuery = (lineToRemove, index) => {
}`;
};
export const V3TargetAndGroupFinder = (job) => {
export const V3GroupFinder = (job) => {
//Query the Job Targets Database to get one that will match on the Make and Type.
//Using faked data for now.
//TODO - Once verified, replace with real data.
let type = job.v_type === "PC" || job.v_type === "SUV" ? "PC" : job.v_type;
const result = FakedTargetsForV3WithMake.filter((f) => {
const result = FakedGroupsForV3WithMake.filter((f) => {
return (
f.make === job.v_makedesc.toUpperCase() &&
(f.type === type || f.type === null) &&
@@ -232,6 +232,39 @@ export const V3TargetAndGroupFinder = (job) => {
}
};
export const V3TargetFinder = (job) => {
switch (job.group) {
case "Default":
case "Group 1":
return 0.023;
case "Group 2":
return 0.045;
case "Group 3":
return 0.078;
case "Group 4":
return 0.093;
case "Group 5":
return 0.125;
case "Group 6":
return 0.156;
case "Group 7":
return 0.18;
case "Group 8":
return 0.213;
case "Group 9":
return 0.25;
case "Group 10":
return 0.281;
case "Group 11":
return 0.293;
case "Group 12":
return 0.32;
default:
return 0.023;
}
};
const DetermineVehicleGroup = async (job) => {
logger.info(
"Searching for vehicle groups.!",
@@ -243,7 +276,7 @@ const DetermineVehicleGroup = async (job) => {
const RulesetToApply = WhichRulesetToApply(job.close_date);
if (RulesetToApply === "V3") {
const target = V3TargetAndGroupFinder(job);
const target = V3GroupFinder(job);
return target?.group || "Default";
} else {
@@ -297,7 +330,7 @@ const DetermineVehicleType = (job) => {
else return job.v_type;
};
export const FakedTargetsForV3WithMake = [
export const FakedGroupsForV3WithMake = [
{
effective_date: Date("2024-09-01"),
end_date: Date("2050-01-01"),

View File

@@ -194,6 +194,7 @@
"ARMADA",
"TELLURIDE",
"PALLISADE",
"SELTOS",
"TORRENT",
"C-HR",
"SPORTAGE",
@@ -225,5 +226,6 @@
"FJ CRUISER",
"BRONCO SPORT",
"BRONCO SPORT BADLANDS",
"ESCALADE"
"ESCALADE",
"RX 350"
]

View File

@@ -1,4 +1,4 @@
import { V3TargetAndGroupFinder } from "../ipc/ipc-estimate-utils";
import { V3TargetFinder } from "../ipc/ipc-estimate-utils";
import { store } from "../redux/store";
import { WhichRulesetToApply } from "./constants";
@@ -30,8 +30,8 @@ export default function GetJobTarget({ group, v_age, targets, close_date, v_mile
if (v_mileage && v_mileage <= 20000) {
return 0;
}
const v3Target = V3TargetAndGroupFinder(job);
return v3Target?.target || 0.023;
const v3Target = V3TargetFinder(job);
return v3Target;
} else {
const newTargetsForGroup = newTargets.filter((t) => t.name === rulesToApply && t.group === group);