* @brief Returns a trimmed dataset array carrying only fields the assistant needs. */
| 933 | * @brief Returns a trimmed dataset array carrying only fields the assistant needs. |
| 934 | */ |
| 935 | static QJsonArray compactDatasets(const QJsonArray& datasets) |
| 936 | { |
| 937 | QJsonArray rows; |
| 938 | for (const auto& value : datasets) { |
| 939 | const auto ds = value.toObject(); |
| 940 | QJsonObject row; |
| 941 | row[Keys::DatasetId] = ds.value(Keys::DatasetId).toInt(); |
| 942 | row[Keys::UniqueId] = ds.value(Keys::UniqueId).toInt(); |
| 943 | row[QStringLiteral("index")] = ds.value(QStringLiteral("index")).toInt(); |
| 944 | row[QStringLiteral("title")] = ds.value(QStringLiteral("title")).toString(); |
| 945 | if (ds.contains(QStringLiteral("units"))) |
| 946 | row[QStringLiteral("units")] = ds.value(QStringLiteral("units")).toString(); |
| 947 | |
| 948 | if (ds.contains(QStringLiteral("enabledOptionsSlugs"))) |
| 949 | row[QStringLiteral("enabledOptionsSlugs")] = |
| 950 | ds.value(QStringLiteral("enabledOptionsSlugs")).toArray(); |
| 951 | |
| 952 | if (ds.value(QStringLiteral("hasTransform")).toBool()) |
| 953 | row[QStringLiteral("hasTransform")] = true; |
| 954 | |
| 955 | if (ds.value(QStringLiteral("isVirtual")).toBool()) |
| 956 | row[QStringLiteral("isVirtual")] = true; |
| 957 | |
| 958 | rows.append(row); |
| 959 | } |
| 960 | return rows; |
| 961 | } |
| 962 | |
| 963 | /** |
| 964 | * @brief Compacts a project.snapshot result into the assistant.snapshot shape. |
no test coverage detected