diff options
Diffstat (limited to 'tests/hawd/modules/json.cpp')
-rw-r--r-- | tests/hawd/modules/json.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/hawd/modules/json.cpp b/tests/hawd/modules/json.cpp index d08df49..d299761 100644 --- a/tests/hawd/modules/json.cpp +++ b/tests/hawd/modules/json.cpp | |||
@@ -73,9 +73,15 @@ bool Json::toJson(const QStringList &commands, State &state) | |||
73 | QJsonObject jsonRow; | 73 | QJsonObject jsonRow; |
74 | jsonRow.insert("timestamp", QJsonValue::fromVariant(row.timestamp())); | 74 | jsonRow.insert("timestamp", QJsonValue::fromVariant(row.timestamp())); |
75 | jsonRow.insert("commit", row.commitHash()); | 75 | jsonRow.insert("commit", row.commitHash()); |
76 | QJsonArray columnsArray; | ||
76 | for (const auto &col : columns) { | 77 | for (const auto &col : columns) { |
77 | jsonRow.insert(col.first, QJsonValue::fromVariant(row.value(col.first))); | 78 | QJsonObject columnObject; |
79 | columnObject.insert("unit", QJsonValue::fromVariant(col.second.unit())); | ||
80 | columnObject.insert("name", QJsonValue::fromVariant(col.first)); | ||
81 | columnObject.insert("value", QJsonValue::fromVariant(row.value(col.first))); | ||
82 | columnsArray << columnObject; | ||
78 | } | 83 | } |
84 | jsonRow.insert("columns", columnsArray); | ||
79 | array.append(jsonRow); | 85 | array.append(jsonRow); |
80 | }); | 86 | }); |
81 | json.insert("rows", array); | 87 | json.insert("rows", array); |