* @brief Back-fills missing uniqueIds and bumps the allocator past every assigned uid. */
| 756 | * @brief Back-fills missing uniqueIds and bumps the allocator past every assigned uid. |
| 757 | */ |
| 758 | void DataModel::ProjectModel::seedNextUniqueIdFromGroups() |
| 759 | { |
| 760 | int maxUid = 0; |
| 761 | |
| 762 | for (auto& group : m_groups) { |
| 763 | for (auto& dataset : group.datasets) { |
| 764 | if (dataset.uniqueId < 0) |
| 765 | dataset.uniqueId = dataset_unique_id(group.sourceId, dataset.groupId, dataset.datasetId); |
| 766 | |
| 767 | if (dataset.uniqueId > maxUid) |
| 768 | maxUid = dataset.uniqueId; |
| 769 | } |
| 770 | |
| 771 | if (group.uniqueId > maxUid) |
| 772 | maxUid = group.uniqueId; |
| 773 | } |
| 774 | |
| 775 | if (m_nextUniqueId <= maxUid) |
| 776 | m_nextUniqueId = maxUid + 1; |
| 777 | |
| 778 | for (auto& group : m_groups) |
| 779 | if (group.uniqueId < 0) |
| 780 | group.uniqueId = m_nextUniqueId++; |
| 781 | |
| 782 | deduplicateUniqueIds(); |
| 783 | } |
| 784 | |
| 785 | /** |
| 786 | * @brief Enforces globally unique dataset+group uniqueIds across all sources. Downstream |
nothing calls this directly
no test coverage detected