From 2eaa719aca4415ad51271189ef6ab94800b5fa75 Mon Sep 17 00:00:00 2001 From: Jissin Mathew Date: Thu, 18 Jun 2026 19:21:59 +0530 Subject: [PATCH 1/2] Fix Multiple Notifications Contain Formatting Issues, Vague Messaging, and Duplicate Entries Changes: - Updated ServiceManagementService::createJobCard() to prevent duplicate "Technician assigned" notifications when multiple job cards exist for the same booking. - Refined job card creation notification to include Job Card ID, Service ID, and Booking ID for clearer technician communication. - Corrected service booking cancellation notification formatting by standardizing capitalization and improving message clarity. - Improved service booking completion notification to explicitly mention the booking ID and confirm invoice generation. - Ensured consistent notification titles and messages across the workflow for better user understanding. Fixes #2114 --- .../services/ServiceManagementService.cpp | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/ServiceManagementService.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/ServiceManagementService.cpp index 5e0b30d..210de1e 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/ServiceManagementService.cpp +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/ServiceManagementService.cpp @@ -629,6 +629,7 @@ void ServiceManagementService::createJobCard(const std::string& bookingID, const DataStoreLockGuard lock(m_dataStore); UserManagementService m_userManagementService; ServiceBooking* currentBooking = getServiceBooking(bookingID); + std::string title, message; if (currentBooking == nullptr) { throw std::runtime_error("Service Booking not available"); @@ -684,18 +685,31 @@ void ServiceManagementService::createJobCard(const std::string& bookingID, const trackedCurrentInventoryItem.state = RecordState::MODIFIED; } } - currentBooking->setAssignedTechnician(selectedTechnician); - currentBooking->setAssignedTechnicianId(selectedTechnician->getId()); + auto currentAssignedTechnician = currentBooking->getAssignedTechnician(); + auto currentAssignedTechnicianId = currentBooking->getAssignedTechnicianId(); + currentBooking->getAssignedTechnicianId(); + if (!currentAssignedTechnician && currentAssignedTechnicianId.empty()) + { + currentBooking->setAssignedTechnician(selectedTechnician); + currentBooking->setAssignedTechnicianId(selectedTechnician->getId()); + title = "Technician assigned"; + message = "A technician has been assigned to your Service Booking with ID " + bookingID; + sendNotification(currentBooking->getCustomer(), title, message); + } + if (currentBooking->getStatus() == util::ServiceJobStatus::PENDING) { currentBooking->setStatus(util::ServiceJobStatus::STARTED); } currentTrackedServiceBooking.state = RecordState::MODIFIED; - std::string title = "Job card created"; - std::string message = "Job card created for the service and you are assigned for that."; JobCard* jobCard = Factory::getObject(bookingID, currentBooking, currentService, serviceID, technicianID, selectedTechnician, util::Timestamp(), util::ServiceJobStatus::STARTED, util::Timestamp()); if (jobCard) { + title = "Job Card Assigned"; + message = "A new Job Card (ID: " + jobCard->getId() + + ") has been created for Service " + serviceID + + " in Booking " + bookingID + + ". You have been assigned to this job."; currentTrackedJobCards.insert(jobCard->getId(), util::createNewRecord(jobCard)); sendNotification(selectedTechnician, title, message); } @@ -703,9 +717,6 @@ void ServiceManagementService::createJobCard(const std::string& bookingID, const { throw std::runtime_error("Failed to create job card."); } - title = "Technician assigned"; - message = "A technician has been assigned to your Service Booking with ID " + bookingID; - sendNotification(currentBooking->getCustomer(), title, message); m_dataStore.saveJobCards(); m_dataStore.saveServiceBookings(); m_dataStore.saveInventoryItems(); @@ -852,8 +863,8 @@ void ServiceManagementService::removeServiceBooking(const std::string& bookingID { if (currentServiceBooking->getStatus() == util::ServiceJobStatus::PENDING) { - const std::string title = "Service Booking cancelled."; - const std::string message = "Service Booking of id " + bookingID + " successfully cancelled."; + const std::string title = "Service Booking Cancelled"; + const std::string message = "Service Booking (ID: " + bookingID + ") has been successfully cancelled"; currentServiceBooking->setStatus(util::ServiceJobStatus::CANCELLED); currentTrackedServiceBooking.state = RecordState::MODIFIED; serviceBookingRemoved = true; @@ -1025,8 +1036,8 @@ void ServiceManagementService::updateJobStatus(const std::string& jobID) currentJob->getBooking()->setStatus(util::ServiceJobStatus::COMPLETED); trackedServiceBookings.getValueAt(trackedServiceBookings.find(bookingId)).state = RecordState::MODIFIED; paymentManagementService.generateInvoice(currentJob->getBooking()); - std::string title = "Service Booking completed. Invoice Generated."; - std::string message = "Services completed for the booking and invoice generated."; + std::string title = "Service Booking Completed"; + std::string message = "Service Booking (ID: " + bookingId + ") has been completed successfully. An invoice has been generated."; sendNotification(currentJob->getBooking()->getCustomer(), title, message); } } From 684d6d38602d768204fa67ca16590a3a8a9bb6db Mon Sep 17 00:00:00 2001 From: Jissin Mathew Date: Thu, 18 Jun 2026 19:43:41 +0530 Subject: [PATCH 2/2] Implement review fixes --- .../services/ServiceManagementService.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/ServiceManagementService.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/ServiceManagementService.cpp index 210de1e..e904d25 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/ServiceManagementService.cpp +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/ServiceManagementService.cpp @@ -685,9 +685,8 @@ void ServiceManagementService::createJobCard(const std::string& bookingID, const trackedCurrentInventoryItem.state = RecordState::MODIFIED; } } - auto currentAssignedTechnician = currentBooking->getAssignedTechnician(); - auto currentAssignedTechnicianId = currentBooking->getAssignedTechnicianId(); - currentBooking->getAssignedTechnicianId(); + const User* currentAssignedTechnician = currentBooking->getAssignedTechnician(); + const std::string& currentAssignedTechnicianId = currentBooking->getAssignedTechnicianId(); if (!currentAssignedTechnician && currentAssignedTechnicianId.empty()) { currentBooking->setAssignedTechnician(selectedTechnician);