From 92351d3123a9625add59d5cc272754284b0706f8 Mon Sep 17 00:00:00 2001 From: velz Date: Wed, 17 Dec 2025 12:51:03 +0530 Subject: [PATCH] CHANGE_FUELTYPE_POST_PROCESS --- app/Controllers/PolicyController.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/app/Controllers/PolicyController.php b/app/Controllers/PolicyController.php index 62062b8..36839ad 100644 --- a/app/Controllers/PolicyController.php +++ b/app/Controllers/PolicyController.php @@ -532,14 +532,24 @@ class PolicyController extends ResourceController $data = $readDoc['data']; $vehicleType = $data['vehicle']['vehicle_type'] ?? null; + $fuelType = $data['vehicle']['fuel_type'] ?? null; if($vehicleType !== null) { - $vehicleType = $this->resolveVehicleTypeTier1($vehicleType); + $vehicleType = $this->postProcessGeminiData($vehicleType,$this->tier1VehicleTypeMap); } else { $vehicleType = 'UN_IDEN_DOC'; } + if($fuelType !== null) + { + $fuelType = $this->postProcessGeminiData($fuelType,$this->fuelType); + } + else + { + $fuelType = 'UN_IDEN_DOC'; + } + //update data in to policy table $policyData['policy_number'] = $data['policy']['policy_number'] ?? null; $policyData['issued_date'] = $data['policy']['issue_date'] ?? null; @@ -556,7 +566,7 @@ class PolicyController extends ResourceController $policyData['rto_state_code'] = $data['vehicle']['rto_state_code'] ?? null; $policyData['rto_city_code'] = $data['vehicle']['rto_city_code'] ?? null; $policyData['weight'] = $data['vehicle']['weight'] ?? null; - $policyData['fuel_type'] = $data['vehicle']['fuel_type'] ?? null; + $policyData['fuel_type'] = $fuelType; $policyData['date_of_registration'] = $data['vehicle']['date_of_registration'] ?? null; $policyData['year_of_manufacture'] = $data['vehicle']['year_of_manufacture'] ?? null; $policyData['engine_no'] = $data['vehicle']['engine_no'] ?? null; @@ -1016,13 +1026,13 @@ class PolicyController extends ResourceController } } - public function resolveVehicleTypeTier1(string $incoming) + public function postProcessGeminiData(string $incoming, array $masterArray): string { $value = strtolower(trim($incoming)); $value = preg_replace('/\s+/', ' ', $value); // normalize spaces - return $this->phraseMap[$value] ?? 'UN_IDEN_TYPE'; + return $masterArray[$value] ?? 'UN_IDEN_TYPE'; } public function calculateCommissionRequest()