* @brief Builds the groups+datasets array; writes total dataset count to @a totalDatasets. */
| 3751 | * @brief Builds the groups+datasets array; writes total dataset count to @a totalDatasets. |
| 3752 | */ |
| 3753 | static QJsonArray buildSnapshotGroups(const DataModel::ProjectModel& pm, int& totalDatasets) |
| 3754 | { |
| 3755 | QJsonArray groups; |
| 3756 | totalDatasets = 0; |
| 3757 | for (const auto& group : pm.groups()) { |
| 3758 | QJsonObject g; |
| 3759 | g[Keys::GroupId] = group.groupId; |
| 3760 | g[Keys::Title] = group.title; |
| 3761 | g[QStringLiteral("widget")] = group.widget; |
| 3762 | g[QStringLiteral("datasetCount")] = static_cast<int>(group.datasets.size()); |
| 3763 | |
| 3764 | QJsonArray ds; |
| 3765 | for (const auto& dataset : group.datasets) { |
| 3766 | ds.append(buildDatasetObject(dataset, group)); |
| 3767 | ++totalDatasets; |
| 3768 | } |
| 3769 | g[QStringLiteral("datasets")] = ds; |
| 3770 | g[QStringLiteral("_explanations")] = buildGroupExplanations(group); |
| 3771 | groups.append(g); |
| 3772 | } |
| 3773 | return groups; |
| 3774 | } |
| 3775 | |
| 3776 | /** |
| 3777 | * @brief Builds the workspace summary array used by project.snapshot. |
no test coverage detected