##// END OF EJS Templates
Fix bug in discard method to handle repository
perrinel -
r1299:7cb3c310ed8d
parent child
Show More
@@ -196,18 +196,29 void CatalogueController::discardEvent(std::shared_ptr<DBEvent> event)
196 196 auto uniqIdPredicate = std::make_shared<ComparaisonPredicate>(
197 197 QString{"uniqId"}, event->getUniqId(), ComparaisonOperation::EQUALEQUAL);
198 198
199 auto repositoryPredicate = std::make_shared<ComparaisonPredicate>(
199 auto syncRepositoryPredicate = std::make_shared<ComparaisonPredicate>(
200 200 QString{"repository"}, impl->toSyncRepository(event->getRepository()),
201 201 ComparaisonOperation::EQUALEQUAL);
202 202
203 auto compCompoundPred = std::make_shared<CompoundPredicate>(CompoundOperation::AND);
204 compCompoundPred->AddRequestPredicate(uniqIdPredicate);
205 compCompoundPred->AddRequestPredicate(repositoryPredicate);
203 auto syncPred = std::make_shared<CompoundPredicate>(CompoundOperation::AND);
204 syncPred->AddRequestPredicate(uniqIdPredicate);
205 syncPred->AddRequestPredicate(syncRepositoryPredicate);
206 206
207 207
208 auto syncEvent = impl->m_CatalogueDao.getEvent(compCompoundPred);
208 auto workRepositoryPredicate = std::make_shared<ComparaisonPredicate>(
209 QString{"repository"}, impl->toWorkRepository(event->getRepository()),
210 ComparaisonOperation::EQUALEQUAL);
211
212 auto workPred = std::make_shared<CompoundPredicate>(CompoundOperation::AND);
213 workPred->AddRequestPredicate(uniqIdPredicate);
214 workPred->AddRequestPredicate(workRepositoryPredicate);
215
216
217 auto syncEvent = impl->m_CatalogueDao.getEvent(syncPred);
209 218 impl->m_CatalogueDao.copyEvent(syncEvent, impl->toWorkRepository(event->getRepository()), true);
210 *event = syncEvent;
219
220 auto workEvent = impl->m_CatalogueDao.getEvent(workPred);
221 *event = workEvent;
211 222 impl->m_EventKeysWithChanges.remove(impl->eventUniqueKey(event));
212 223 }
213 224
General Comments 3
Under Review
author

Auto status change to "Under Review"

Approved
author

Status change > Approved

You need to be logged in to leave comments. Login now