From defee9aa155cc3fbc336971a7a7613ecac8a5781 Mon Sep 17 00:00:00 2001 From: Joel Thomas Date: Wed, 27 May 2026 15:59:45 +0530 Subject: [PATCH] Fix ServiceBooking ID prefix and notification messages - change ServiceBooking ID prefix from `SRV` to `SBK` - add customer notification when technician is assigned to booking - fix typo in job completion exception message - remove unnecessary newline characters from completion notifications Fixes #1780 --- .../models/ServiceBooking.cpp | 5 +++-- .../services/ServiceManagementService.cpp | 11 +++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/ServiceBooking.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/ServiceBooking.cpp index 8e8b8d7..31b9d87 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/ServiceBooking.cpp +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/ServiceBooking.cpp @@ -24,9 +24,10 @@ Parameters: None Returns: A new ServiceBooking object. */ ServiceBooking::ServiceBooking() - : m_id("SRV" + std::to_string(++m_uid)), + : m_id("SBK" + std::to_string(++m_uid)), m_customer(nullptr), m_assignedTechnician(nullptr), + m_status(util::ServiceJobStatus::PENDING), m_discountPercentage(0.0) {} /* @@ -56,7 +57,7 @@ ServiceBooking::ServiceBooking( const std::string& vehicleModel, double discountPercentage ) - : m_id("SRV" + std::to_string(++m_uid)), + : m_id("SBK" + std::to_string(++m_uid)), m_status(status), m_services(services), m_customerId(customerId), diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/ServiceManagementService.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/ServiceManagementService.cpp index 2135b5e..c0478fc 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/ServiceManagementService.cpp +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/ServiceManagementService.cpp @@ -833,6 +833,9 @@ 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); } /* @@ -1055,11 +1058,11 @@ void ServiceManagementService::completeJob(const std::string& jobID) } else { - throw std::runtime_error("Failed to complete the job, some error occured or job already completed."); + throw std::runtime_error("Failed to complete the job, some error occurred or job already completed."); } if (!jobStatusUpdated) { - throw std::runtime_error("Failed to complete the job, some error occured or job already completed."); + throw std::runtime_error("Failed to complete the job, some error occurred or job already completed."); } serviceBookingCompleted = hasCompletedAllJobs(currentJob->getBookingId(), currentAssignedJobs); @@ -1067,8 +1070,8 @@ void ServiceManagementService::completeJob(const std::string& jobID) { currentJob->getBooking()->setStatus(util::ServiceJobStatus::COMPLETED); paymentManagementService.generateInvoice(currentJob->getBooking()); - std::string title = "Service Booking completed,Invoice Generated.\n"; - std::string message = "Services completed for the booking and invoice generated.\n"; + std::string title = "Service Booking completed,Invoice Generated."; + std::string message = "Services completed for the booking and invoice generated."; sendNotification(currentJob->getBooking()->getCustomer(), title, message); } } \ No newline at end of file