Implement Review fixes

This commit is contained in:
Jissin Mathew
2026-06-18 11:33:10 +05:30
parent b45463a66d
commit ca0e277586
2 changed files with 5 additions and 4 deletions
@@ -222,6 +222,7 @@ void DataStore::refreshCache(util::Map<std::string, TrackedRecord<TObject>>& cac
TrackedRecord<TObject>& oldRecord = oldCache.getValueAt(oldIndex); TrackedRecord<TObject>& oldRecord = oldCache.getValueAt(oldIndex);
if (oldRecord.state == RecordState::MODIFIED) if (oldRecord.state == RecordState::MODIFIED)
{ {
delete refreshedRecord.data;
cache.insert(id, oldRecord); cache.insert(id, oldRecord);
continue; continue;
} }
@@ -594,6 +594,10 @@ void ServiceManagementService::createJobCard(const std::string& bookingID, const
DataStoreLockGuard lock(m_dataStore); DataStoreLockGuard lock(m_dataStore);
UserManagementService m_userManagementService; UserManagementService m_userManagementService;
ServiceBooking* currentBooking = getServiceBooking(bookingID); ServiceBooking* currentBooking = getServiceBooking(bookingID);
if (currentBooking == nullptr)
{
throw std::runtime_error("Service Booking not available");
}
if (currentBooking->getStatus() == util::ServiceJobStatus::CANCELLED) if (currentBooking->getStatus() == util::ServiceJobStatus::CANCELLED)
{ {
throw std::runtime_error("Cannot create job card. Service Booking was cancelled!"); throw std::runtime_error("Cannot create job card. Service Booking was cancelled!");
@@ -607,10 +611,6 @@ void ServiceManagementService::createJobCard(const std::string& bookingID, const
throw std::runtime_error("Invalid service booking id."); throw std::runtime_error("Invalid service booking id.");
} }
auto& currentTrackedServiceBooking = currentTrackedServiceBookings.getValueAt(currentTrackedServiceBookingIndex); auto& currentTrackedServiceBooking = currentTrackedServiceBookings.getValueAt(currentTrackedServiceBookingIndex);
if (currentBooking == nullptr)
{
throw std::runtime_error("Service Booking not available");
}
auto& currentServices = currentBooking->getServices(); auto& currentServices = currentBooking->getServices();
if (currentServices.find(serviceID) == -1) if (currentServices.find(serviceID) == -1)
{ {