From afa450c34cccb8292fd9054be8bf965d5bf3778a Mon Sep 17 00:00:00 2001 From: Ming Rui Zhang <mingrui.zhang@savoirfairelinux.com> Date: Fri, 4 Jun 2021 16:04:49 -0400 Subject: [PATCH] storagehelper: add missing duration data in extra_data column when inserting Gitlab: #472 Change-Id: I7c40dd5e866f0f64439055313ade43b76f2d0b9e --- src/authority/storagehelper.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/authority/storagehelper.cpp b/src/authority/storagehelper.cpp index bac8e915..3ab5f8bc 100644 --- a/src/authority/storagehelper.cpp +++ b/src/authority/storagehelper.cpp @@ -470,6 +470,9 @@ addOrUpdateMessage(Database& db, {{":author", msg.authorUri}, {":daemon_id", daemonId}}) .payloads; if (msgAlreadyExists.empty()) { + auto extra_data_JSON = JSONFromString(""); + writeJSONValue(extra_data_JSON, "duration", QString::number(msg.duration)); + auto extra_data = stringFromJSON(extra_data_JSON); return db.insertInto("interactions", {{":author", "author"}, {":conversation", "conversation"}, @@ -477,14 +480,16 @@ addOrUpdateMessage(Database& db, {":body", "body"}, {":type", "type"}, {":status", "status"}, - {":daemon_id", "daemon_id"}}, + {":daemon_id", "daemon_id"}, + {":extra_data", "extra_data"}}, {{":author", msg.authorUri.isEmpty() ? "" : msg.authorUri}, {":conversation", conversationId}, {":timestamp", toQString(msg.timestamp)}, {msg.body.isEmpty() ? "" : ":body", msg.body}, {":type", to_string(msg.type)}, {daemonId.isEmpty() ? "" : ":daemon_id", daemonId}, - {":status", to_string(msg.status)}}); + {":status", to_string(msg.status)}, + {extra_data.isEmpty() ? "" : ":extra_data", extra_data}}); } else { // already exists @ id(msgAlreadyExists[0]) auto id = msgAlreadyExists[0]; -- GitLab