Updated issue where old close date not used for calculation of age RPS-75
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user