Skip to content

Commit

Permalink
Fixed crash when car coverage is disabled in upload center
Browse files Browse the repository at this point in the history
  • Loading branch information
souyahia-monk committed Jul 16, 2024
1 parent 37d12da commit 9a8ca25
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ export default function useComplianceIds({
const iqa = result.data.compliances.image_quality_assessment;

// Filter unwanted reasons
carCov.reasons = filterUnwantedComplianceReasons(carCov.reasons);
iqa.reasons = filterUnwantedComplianceReasons(iqa.reasons);
if (carCov) {
carCov.reasons = filterUnwantedComplianceReasons(carCov.reasons);
}
if (iqa) {
iqa.reasons = filterUnwantedComplianceReasons(iqa.reasons);
}

// `handleChangeReasons` returns the full result object with the given compliances
const handleChangeReasons = (compliances) => ({
Expand Down Expand Up @@ -61,7 +65,7 @@ export default function useComplianceIds({
if (!carCov?.reasons) { return { ...item, requestCount, result }; }

// remove the UNKNOWN_SIGHT from the carCov reasons array
const newCarCovReasons = carCov.reasons?.filter((reason) => reason !== UNKNOWN_SIGHT_REASON);
const newCarCovReasons = carCov?.reasons?.filter((reason) => reason !== UNKNOWN_SIGHT_REASON);
return handleChangeReasons({
coverage_360: { reasons: newCarCovReasons, is_compliant: !newCarCovReasons.length },
});
Expand Down

0 comments on commit 9a8ca25

Please sign in to comment.