From a4a3dd1504598d4d4ddf2c1a957cc0beb4ac680c Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Thu, 30 Mar 2017 03:23:00 +0200 Subject: [PATCH] refs #921, support both timestamp formats * DB * JSON object (backend side) --- src/blackmisc/db/datastore.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/blackmisc/db/datastore.cpp b/src/blackmisc/db/datastore.cpp index 320cf1f08..641dc52df 100644 --- a/src/blackmisc/db/datastore.cpp +++ b/src/blackmisc/db/datastore.cpp @@ -75,9 +75,12 @@ namespace BlackMisc void IDatastoreObjectWithIntegerKey::setKeyAndTimestampFromDatabaseJson(const QJsonObject &json, const QString &prefix) { const int dbKey = json.value(prefix + "id").toInt(-1); - const QString timestampString(json.value(prefix + "lastupdated").toString()); - const QDateTime ts(CDatastoreUtility::parseTimestamp(timestampString)); this->setDbKey(dbKey); + + // we check 2 formats, the DB format and the backend object format + QString timestampString(json.value(prefix + "lastupdated").toString()); + if (timestampString.isEmpty()) { timestampString = json.value(prefix + "tsLastUpdated").toString(); } + const QDateTime ts(CDatastoreUtility::parseTimestamp(timestampString)); this->setUtcTimestamp(ts); }