Implement Review Fixes

This commit is contained in:
Avinash Rajesh
2026-05-27 17:30:38 +05:30
committed by Joel Thomas
parent b25b3d59cf
commit b7bc1f574d
2 changed files with 9 additions and 13 deletions
@@ -600,7 +600,6 @@ Return type: void
*/ */
void ServiceManagementService::cancelCustomerServiceBookings(const std::string& customerID) void ServiceManagementService::cancelCustomerServiceBookings(const std::string& customerID)
{ {
const int INCREMENT_VALUE = 1;
auto& users = m_dataStore.getUsers(); auto& users = m_dataStore.getUsers();
int userIndex = users.find(customerID); int userIndex = users.find(customerID);
if (userIndex == -1) if (userIndex == -1)
@@ -621,7 +620,6 @@ void ServiceManagementService::cancelCustomerServiceBookings(const std::string&
{ {
continue; continue;
} }
std::string bookingID = booking->getId();
if (booking->getCustomerId() != customerID) if (booking->getCustomerId() != customerID)
{ {
continue; continue;
@@ -634,7 +632,7 @@ void ServiceManagementService::cancelCustomerServiceBookings(const std::string&
std::string titleToTechnician = "Customer Service Cancelled"; 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 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 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, processBookingCancellation(booking,
util::ServiceJobStatus::CANCELLED, util::ServiceJobStatus::CANCELLED,
titleToTechnician, messageToTechnician, assignedTechnician, titleToTechnician, messageToTechnician, assignedTechnician,
@@ -653,7 +651,6 @@ Return type: void
*/ */
void ServiceManagementService::cancelTechnicianJobs(const std::string& technicianID) void ServiceManagementService::cancelTechnicianJobs(const std::string& technicianID)
{ {
const int INCREMENT_VALUE = 1;
auto& users = m_dataStore.getUsers(); auto& users = m_dataStore.getUsers();
int userIndex = users.find(technicianID); int userIndex = users.find(technicianID);
if (userIndex == -1) if (userIndex == -1)
@@ -679,7 +676,6 @@ void ServiceManagementService::cancelTechnicianJobs(const std::string& technicia
{ {
continue; continue;
} }
std::string bookingID = booking->getId();
if (booking->getStatus() != util::ServiceJobStatus::PENDING && booking->getStatus() != util::ServiceJobStatus::STARTED) if (booking->getStatus() != util::ServiceJobStatus::PENDING && booking->getStatus() != util::ServiceJobStatus::STARTED)
{ {
continue; continue;
@@ -304,16 +304,16 @@ void UserManagementService::removeUser(const std::string& userID)
if (index != -1) if (index != -1)
{ {
User* user = m_dataStore.getUsers().getValueAt(index); 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 != nullptr)
{ {
if (user->getUserType() == util::UserType::CUSTOMER)
{
serviceManagementService.cancelCustomerServiceBookings(userID);
}
if (user->getUserType() == util::UserType::TECHNICIAN)
{
serviceManagementService.cancelTechnicianJobs(userID);
}
user->setState(util::State::INACTIVE); user->setState(util::State::INACTIVE);
inventoryManagementService.detach(user); inventoryManagementService.detach(user);
paymentManagementService.detach(user); paymentManagementService.detach(user);