diff --git a/electron/changelog.json b/electron/changelog.json index d37226b..db50893 100644 --- a/electron/changelog.json +++ b/electron/changelog.json @@ -33,5 +33,10 @@ "title": "Release Notes for 1.0.15", "date": "01/12/2021", "notes": "New Features: \n- Renamed 'Close Date' to 'Ready for Payment' to better align with MPI terminology.\n- Changed vehicle age calculation to use 'Ready for Payment' instead of loss date as per new MPI practices.\n\nBug Fixes: \n- Updated grouping typo on group lookup popup." + }, + "1.0.16": { + "title": "Release Notes for 1.0.16", + "date": "01/12/2021", + "notes": "Bug Fixes: \n- Resolved an issue where vehicle age was calculated using an old date." } } diff --git a/package.json b/package.json index 83475a2..47e0944 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "productName": "ImEX RPS", "author": "ImEX Systems Inc. ", "description": "ImEX RPS", - "version": "1.0.15", + "version": "1.0.16", "main": "electron/main.js", "homepage": "./", "dependencies": { diff --git a/src/graphql/jobs.queries.js b/src/graphql/jobs.queries.js index 3025ddd..a62aab9 100644 --- a/src/graphql/jobs.queries.js +++ b/src/graphql/jobs.queries.js @@ -119,6 +119,7 @@ export const QUERY_JOB_BY_CLM_NO = gql` query QUERY_JOB_BY_CLM_NO($clm_no: String!) { jobs(where: { clm_no: { _eq: $clm_no } }) { id + close_date joblines { id act_price diff --git a/src/ipc/ipc-estimate-utils.js b/src/ipc/ipc-estimate-utils.js index 3c9ab58..f3533e9 100644 --- a/src/ipc/ipc-estimate-utils.js +++ b/src/ipc/ipc-estimate-utils.js @@ -28,17 +28,21 @@ export async function UpsertEstimate(job) { const shopId = store.getState().user.bodyshop.id; logger.info("Beginning Upserting job from Renderer."); - job = { - ...job, - group: await DetermineVehicleGroup(job), - v_age: CalculateVehicleAge(job), - }; - const existingJobs = await client.query({ query: QUERY_JOB_BY_CLM_NO, variables: { clm_no: job.clm_no }, }); + job = { + ...job, + group: await DetermineVehicleGroup(job), + v_age: CalculateVehicleAge({ + ...job, + close_date: + existingJobs.data.jobs[0] && existingJobs.data.jobs[0].close_date, + }), + }; + if (existingJobs.data.jobs.length === 1) { let suppDelta = await GetSupplementDelta( existingJobs.data.jobs[0].id,