mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 21:15:33 +08:00
refs #921, support both timestamp formats
* DB * JSON object (backend side)
This commit is contained in:
committed by
Mathew Sutcliffe
parent
f85501c7bf
commit
a4a3dd1504
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user