Skip to content

Fix a bug on checking for orphans on mount patches

Nils Brinckmann requested to merge fix-checks-for-orphans-on-mount-patches into develop

This fixed the problem that Tim reported in Mattermost: https://mattermost.hzdr.de/hubterra-sms/pl/dtcrbmrzg7dwfqh6a95cdkz48e

Ich glaub es gibt einen Bug beim unmounten von platforms:

mounte eine platform
mounte ein device an diese platform
unmounte das device
unmounte die platform -> fehler vom backend:
{
      "source": "There is still a child mount that is not covered by the updated data.", 
      "status": 409, 
      "title": "Conflict"
    }
{
  "data": {
    "type": "device_mount_action",
    "attributes": {
      "offset_x": 0,
      "offset_y": 0,
      "offset_z": 0,
      "begin_description": "",
      "end_description": "",
      "begin_date": "2022-08-19T09:09:17.271Z",
      "end_date": "2022-08-19T09:09:35.961Z"
    },
    "relationships": {
      "device": {
        "data": {
          "type": "device",
          "id": "9"
        }
      },
      "begin_contact": {
        "data": {
          "type": "contact",
          "id": "1"
        }
      },
      "configuration": {
        "data": {
          "type": "configuration",
          "id": "6"
        }
      },
      "end_contact": {
        "data": {
          "type": "contact",
          "id": "1"
        }
      },
      "parent_platform": {
        "data": {
          "type": "platform",
          "id": "9"
        }
      }
    },
    "id": "9"
  }
}
Mehr anzeigen
der device unmount funktionier

11:10






  "data": {
    "type": "platform_mount_action",
    "attributes": {
      "offset_x": 0,
      "offset_y": 0,
      "offset_z": 0,
      "begin_description": "",
      "end_description": "",
      "begin_date": "2022-08-19T09:08:57.658Z",
      "end_date": "2022-08-19T09:10:20.530Z"
    },
    "relationships": {
      "platform": {
        "data": {
          "type": "platform",
          "id": "9"
        }
      },
      "begin_contact": {
        "data": {
          "type": "contact",
          "id": "1"
        }
      },
      "configuration": {
        "data": {
          "type": "configuration",
          "id": "6"
        }

The problem itself was that the database had a value for the platform id & the configuration that were integers. From the payload we got the values as strings & and the != check considered them as different (even while it was like 8 != "8"). I did that check to check where the configuration was changed.

Now I included Tims example as a test case, and extended this check.

Merge request reports