Added fundamentals for v2 rule set intro.

This commit is contained in:
Patrick Fic
2022-11-23 10:50:19 -08:00
parent 22814bf0a0
commit 0afa584771
16 changed files with 283 additions and 215 deletions

View File

@@ -26,7 +26,6 @@ export function CalculateVehicleAge(job) {
const closeDate = moment(job.close_date);
const lossDate = moment(job.loss_date);
let ret;
console.log(job);
if (closeDate.isSameOrAfter(moment("2023-04-01"))) {
//Post April 2023 rules where the age is calculated based on loss date.
@@ -35,7 +34,7 @@ export function CalculateVehicleAge(job) {
"Using post 0423 ruleset to calculate vehicle age for job.",
job
);
ret = vehicleYr.diff(lossDate, "years");
ret = Math.max(0, lossDate.year() - vehicleYr);
} else {
//Pre-April 2023 rules where the age was calculated based on model year, not loss date.
ipcRenderer.send(
@@ -64,6 +63,7 @@ export async function UpsertEstimate(job) {
job = {
...job,
requires_reimport: false,
v_mileage: (job.v_mileage !== "" && job.v_mileage) || null,
v_type: DetermineVehicleType(job),
v_age: CalculateVehicleAge({