From b7bc1f574d6f588607d994a855dd7f164fa67a68 Mon Sep 17 00:00:00 2001 From: Avinash Rajesh Date: Wed, 27 May 2026 17:30:38 +0530 Subject: [PATCH] Implement Review Fixes --- .../services/ServiceManagementService.cpp | 6 +----- .../services/UserManagementService.cpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/ServiceManagementService.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/ServiceManagementService.cpp index da45370..7d907a6 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/ServiceManagementService.cpp +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/ServiceManagementService.cpp @@ -600,7 +600,6 @@ Return type: void */ void ServiceManagementService::cancelCustomerServiceBookings(const std::string& customerID) { - const int INCREMENT_VALUE = 1; auto& users = m_dataStore.getUsers(); int userIndex = users.find(customerID); if (userIndex == -1) @@ -621,7 +620,6 @@ void ServiceManagementService::cancelCustomerServiceBookings(const std::string& { continue; } - std::string bookingID = booking->getId(); if (booking->getCustomerId() != customerID) { continue; @@ -634,7 +632,7 @@ void ServiceManagementService::cancelCustomerServiceBookings(const std::string& std::string titleToTechnician = "Customer Service Cancelled"; std::string messageToTechnician = "The customer has cancelled their service booking. Your assigned job card has been cancelled and the inventory has been restocked."; std::string jobTitle = "Job Cancelled"; - std::string jobMessage = "The Job has cancelled. Your job card has been cancelled and the inventory has been restocked."; + std::string jobMessage = "The job has been cancelled. Your job card has been cancelled and the inventory has been restocked."; processBookingCancellation(booking, util::ServiceJobStatus::CANCELLED, titleToTechnician, messageToTechnician, assignedTechnician, @@ -653,7 +651,6 @@ Return type: void */ void ServiceManagementService::cancelTechnicianJobs(const std::string& technicianID) { - const int INCREMENT_VALUE = 1; auto& users = m_dataStore.getUsers(); int userIndex = users.find(technicianID); if (userIndex == -1) @@ -679,7 +676,6 @@ void ServiceManagementService::cancelTechnicianJobs(const std::string& technicia { continue; } - std::string bookingID = booking->getId(); if (booking->getStatus() != util::ServiceJobStatus::PENDING && booking->getStatus() != util::ServiceJobStatus::STARTED) { continue; diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/UserManagementService.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/UserManagementService.cpp index df11b15..8ba68d0 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/UserManagementService.cpp +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/UserManagementService.cpp @@ -304,16 +304,16 @@ void UserManagementService::removeUser(const std::string& userID) if (index != -1) { User* user = m_dataStore.getUsers().getValueAt(index); - if (user->getUserType() == util::UserType::CUSTOMER) - { - serviceManagementService.cancelCustomerServiceBookings(userID); - } - if (user->getUserType() == util::UserType::TECHNICIAN) - { - serviceManagementService.cancelTechnicianJobs(userID); - } if (user != nullptr) { + if (user->getUserType() == util::UserType::CUSTOMER) + { + serviceManagementService.cancelCustomerServiceBookings(userID); + } + if (user->getUserType() == util::UserType::TECHNICIAN) + { + serviceManagementService.cancelTechnicianJobs(userID); + } user->setState(util::State::INACTIVE); inventoryManagementService.detach(user); paymentManagementService.detach(user);