1
0
forked from Yara724/api

Fixed price-drop

This commit is contained in:
SepehrYahyaee
2026-06-03 17:04:16 +03:30
parent 16c598118d
commit 9ee933cb76

View File

@@ -4242,9 +4242,10 @@ export class ExpertClaimService {
); );
} }
// Manual path — change totalPriceDrop → total to match calculated path
const manualPayload = { const manualPayload = {
manualOverride: true, manualOverride: true,
totalPriceDrop: body.manualPriceDrop, total: body.manualPriceDrop, // ← was totalPriceDrop
partLines: [], partLines: [],
}; };
@@ -4269,6 +4270,18 @@ export class ExpertClaimService {
} }
// Calculated path — existing logic unchanged // 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 carType = claim.vehicle?.carType as ClaimVehicleTypeV2 | undefined;
const selectedNorm = normalizeDamageSelectedParts( const selectedNorm = normalizeDamageSelectedParts(
claim.damage?.selectedParts, claim.damage?.selectedParts,