From 26af34e73dc7bf42a39e214a55aedb0140702621 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Fri, 13 Nov 2020 11:51:40 -0800 Subject: [PATCH] Added OEM Partno dynamic inclusion and exclusion. RPS-42. Removed glass exclusions RPS-43. --- electron/decoder/decoder.js | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/electron/decoder/decoder.js b/electron/decoder/decoder.js index 8354e3c..77bc966 100644 --- a/electron/decoder/decoder.js +++ b/electron/decoder/decoder.js @@ -60,8 +60,8 @@ async function DecodeEstimate(filePath, includeFilePathInReturnJob = false) { //Removed as a part of RPS-40. // if (job.V_MILEAGE <= 20000) { // returnValue = { ERROR: "Vehicle mileage is less than 20,000kms." }; - // } else - + // } else + if (!accepted_ins_co.includes(job.INS_CO_NM)) { returnValue = { ERROR: `Insurance Company Name is not valid for RPS. (${ @@ -377,7 +377,7 @@ async function DecodeLinFile(extensionlessFilePath) { jobline.part_type === "PAN" && jobline.db_price !== jobline.act_price ) { - jobline.db_price = jobline.act_price; + jobline.db_price = jobline.act_price; } if ( @@ -386,15 +386,11 @@ async function DecodeLinFile(extensionlessFilePath) { !!jobline.act_price && jobline.act_price > jobline.db_price ) { - // log.info( - // "Act price higher than existing db price", - // jobline.line_desc, - // jobline.db_price, - // jobline.act_price - // ); + //Actual price should never be higher than the DB Price. jobline.db_price = jobline.act_price; } + //Logic Based Exclusions. if ( !jobline.part_type || jobline.db_ref.startsWith("900") || @@ -404,15 +400,22 @@ async function DecodeLinFile(extensionlessFilePath) { jobline.line_desc.toLowerCase().startsWith("hazardous") || jobline.line_desc.toLowerCase().startsWith("detail") || jobline.line_desc.toLowerCase().startsWith("clean") || - // jobline.part_type.toUpperCase() === "PAG" || + // jobline.part_type.toUpperCase() === "PAG" ||Removed for RPS-43. jobline.part_type.toUpperCase() === "PAS" || jobline.part_type.toUpperCase() === "PASL" || jobline.part_type.toUpperCase() === "PAE" || - //jobline.glass_flag === true || + //jobline.glass_flag === true //Removed for RPS-43. jobline.db_price === 0 ) jobline.ignore = true; + //RPS-42 Dynamic Inclusion or Exclusion of Lines based on RPS-EXCLUDE or RPS. + if (jobline.oem_partno.toLowerCase().includes("/rps-exclude")) { + jobline.ignore = true; + } else if (jobline.oem_partno.toLowerCase().includes("/rps")) { + jobline.ignore = false; + } + delete jobline.glass_flag; return jobline; });