From de5bd0955ac50fe17aaf0a02055cc70836b7e4ae Mon Sep 17 00:00:00 2001 From: Minijackson Date: Wed, 22 Aug 2018 13:45:49 +0200 Subject: Fix "contains" function + write tests for contains and exists --- common/storage/entitystore.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'common/storage/entitystore.cpp') diff --git a/common/storage/entitystore.cpp b/common/storage/entitystore.cpp index a92de40..454e25a 100644 --- a/common/storage/entitystore.cpp +++ b/common/storage/entitystore.cpp @@ -630,11 +630,10 @@ void EntityStore::readAllUids(const QByteArray &type, const std::functiongetTransaction(), callback); } -bool EntityStore::contains(const QByteArray &type, const QByteArray &uid) +bool EntityStore::contains(const QByteArray & /* type */, const QByteArray &uid) { Q_ASSERT(!uid.isEmpty()); - const auto internalUid = Identifier::fromDisplayByteArray(uid).toInternalByteArray(); - return DataStore::mainDatabase(d->getTransaction(), type).contains(internalUid); + return !DataStore::getRevisionsFromUid(d->getTransaction(), uid).isEmpty(); } bool EntityStore::exists(const QByteArray &type, const QByteArray &uid) -- cgit v1.2.3