* @brief Patches dataset min/max ranges from the optional `ranges` request payload. */
| 1631 | * @brief Patches dataset min/max ranges from the optional `ranges` request payload. |
| 1632 | */ |
| 1633 | static QJsonObject applyTileRangeUpdates(const QJsonObject& args, |
| 1634 | const QJsonObject& dataset, |
| 1635 | int groupId, |
| 1636 | QJsonArray& steps) |
| 1637 | { |
| 1638 | const auto ranges = args.value(QStringLiteral("ranges")).toObject(); |
| 1639 | if (ranges.isEmpty() || dataset.isEmpty()) |
| 1640 | return {}; |
| 1641 | |
| 1642 | static const QStringList kRangeFields = {QStringLiteral("pltMin"), |
| 1643 | QStringLiteral("pltMax"), |
| 1644 | QStringLiteral("wgtMin"), |
| 1645 | QStringLiteral("wgtMax"), |
| 1646 | QStringLiteral("fftMin"), |
| 1647 | QStringLiteral("fftMax")}; |
| 1648 | QJsonObject updateArgs; |
| 1649 | updateArgs[QStringLiteral("groupId")] = dataset.value(QStringLiteral("groupId")).toInt(groupId); |
| 1650 | updateArgs[Keys::DatasetId] = dataset.value(Keys::DatasetId).toInt(); |
| 1651 | for (const auto& field : kRangeFields) |
| 1652 | if (ranges.contains(field)) |
| 1653 | updateArgs[field] = ranges.value(field); |
| 1654 | |
| 1655 | if (updateArgs.size() <= 2) |
| 1656 | return {}; |
| 1657 | |
| 1658 | const auto updateReply = runCommand(QStringLiteral("project.dataset.update"), updateArgs); |
| 1659 | steps.append(QJsonObject{ |
| 1660 | { QStringLiteral("command"), QStringLiteral("project.dataset.update")}, |
| 1661 | { QStringLiteral("ok"), updateReply.value(QStringLiteral("ok")).toBool()}, |
| 1662 | {QStringLiteral("arguments"), updateArgs} |
| 1663 | }); |
| 1664 | return updateReply; |
| 1665 | } |
| 1666 | |
| 1667 | /** |
| 1668 | * @brief Enables customize mode so subsequent workspace mutations are accepted. |
no test coverage detected