forked from Yara724/api
Fixed price-drop
This commit is contained in:
@@ -4242,9 +4242,10 @@ export class ExpertClaimService {
|
||||
);
|
||||
}
|
||||
|
||||
// Manual path — change totalPriceDrop → total to match calculated path
|
||||
const manualPayload = {
|
||||
manualOverride: true,
|
||||
totalPriceDrop: body.manualPriceDrop,
|
||||
total: body.manualPriceDrop, // ← was totalPriceDrop
|
||||
partLines: [],
|
||||
};
|
||||
|
||||
@@ -4269,6 +4270,18 @@ export class ExpertClaimService {
|
||||
}
|
||||
|
||||
// Calculated path — existing logic unchanged
|
||||
// At the top of the calculated path, after the manualPriceDrop early return:
|
||||
const existingPriceDrop = (claim as any).evaluation?.priceDrop;
|
||||
if (
|
||||
existingPriceDrop?.manualOverride === true &&
|
||||
!body.partSeverities?.length
|
||||
) {
|
||||
throw new BadRequestException(
|
||||
"This claim has a manual price-drop correction. " +
|
||||
"To recalculate, provide partSeverities explicitly — this will replace the manual correction.",
|
||||
);
|
||||
}
|
||||
|
||||
const carType = claim.vehicle?.carType as ClaimVehicleTypeV2 | undefined;
|
||||
const selectedNorm = normalizeDamageSelectedParts(
|
||||
claim.damage?.selectedParts,
|
||||
|
||||
Reference in New Issue
Block a user