##// END OF EJS Templates
Fix bug in discard method to handle repository
perrinel -
r1276:2a5c49125dee
parent child
Show More
@@ -196,18 +196,29 void CatalogueController::discardEvent(std::shared_ptr<DBEvent> event)
196 auto uniqIdPredicate = std::make_shared<ComparaisonPredicate>(
196 auto uniqIdPredicate = std::make_shared<ComparaisonPredicate>(
197 QString{"uniqId"}, event->getUniqId(), ComparaisonOperation::EQUALEQUAL);
197 QString{"uniqId"}, event->getUniqId(), ComparaisonOperation::EQUALEQUAL);
198
198
199 auto repositoryPredicate = std::make_shared<ComparaisonPredicate>(
199 auto syncRepositoryPredicate = std::make_shared<ComparaisonPredicate>(
200 QString{"repository"}, impl->toSyncRepository(event->getRepository()),
200 QString{"repository"}, impl->toSyncRepository(event->getRepository()),
201 ComparaisonOperation::EQUALEQUAL);
201 ComparaisonOperation::EQUALEQUAL);
202
202
203 auto compCompoundPred = std::make_shared<CompoundPredicate>(CompoundOperation::AND);
203 auto syncPred = std::make_shared<CompoundPredicate>(CompoundOperation::AND);
204 compCompoundPred->AddRequestPredicate(uniqIdPredicate);
204 syncPred->AddRequestPredicate(uniqIdPredicate);
205 compCompoundPred->AddRequestPredicate(repositoryPredicate);
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 impl->m_CatalogueDao.copyEvent(syncEvent, impl->toWorkRepository(event->getRepository()), true);
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 impl->m_EventKeysWithChanges.remove(impl->eventUniqueKey(event));
222 impl->m_EventKeysWithChanges.remove(impl->eventUniqueKey(event));
212 }
223 }
213
224
General Comments 0
You need to be logged in to leave comments. Login now