Jump to content

Remove event 'parents' out of order


Fernando

Recommended Posts

Hello,

It appears that sometimes with a remove event the order of the parents will be wrong (starting from the current object being removed to the project)
This happens when you remove an entity that contains other entities, for instance a Folder containing a Task and deleting the Folder.
Here you can see the event for the task getting removed and the parents being out of order:

{'action': 'remove',
 'changes': {'bid': {'new': None, 'old': 0.0},
             'context_type': {'new': None, 'old': 'task'},
             'created_by': {'new': None,
                            'old': '7304e7ca-6b30-4883-9ac3-2790e0f2863d'},
             'description': {'new': None, 'old': ''},
             'enddate': {'new': None, 'old': None},
             'id': {'new': None, 'old': '9aa5e865-7166-4263-ad35-84235c29e8d6'},
             'isopen': {'new': None, 'old': False},
             'isrequirecomment': {'new': None, 'old': False},
             'name': {'new': None, 'old': 'Task name'},
             'object_typeid': {'new': None,
                               'old': '11c137c0-ee7e-4f9c-91c5-8c77cec22b2c'},
             'parent_id': {'new': None,
                           'old': 'ded66c29-a108-4040-8e4e-5c41277f3be8'},
             'priorityid': {'new': None,
                            'old': '9661b320-3a0c-11e2-81c1-0800200c9a66'},
             'project_id': {'new': None,
                            'old': '21ab25fe-1326-11ed-8f22-226b2eaee502'},
             'showid': {'new': None,
                        'old': '21ab25fe-1326-11ed-8f22-226b2eaee502'},
             'sort': {'new': None, 'old': 0.0},
             'startdate': {'new': None, 'old': None},
             'statusid': {'new': None,
                          'old': 'b8da42a6-d1fa-11ec-bd18-c2c2635a447b'},
             'taskid': {'new': None,
                        'old': '9aa5e865-7166-4263-ad35-84235c29e8d6'},
             'thumbid': {'new': None, 'old': None},
             'typeid': {'new': None,
                        'old': 'eb42a444-cfca-11ed-bc56-8207c690cda3'}},
 'entityId': '9aa5e865-7166-4263-ad35-84235c29e8d6',
 'entityType': 'task',
 'entity_type': 'Task',
 'keys': ['id',
          'taskid',
          'thumbid',
          'created_at',
          'context_type',
          'name',
          'parent_id',
          'created_by',
          'bid',
          'description',
          'startdate',
          'enddate',
          'statusid',
          'typeid',
          'priorityid',
          'isopen',
          'isrequirecomment',
          'object_typeid',
          'showid',
          'sort',
          'project_id'],
 'objectTypeId': '11c137c0-ee7e-4f9c-91c5-8c77cec22b2c',
 'parentId': 'ded66c29-a108-4040-8e4e-5c41277f3be8',
 'parents': [{'entityId': '9aa5e865-7166-4263-ad35-84235c29e8d6',
              'entityType': 'task',
              'entity_type': 'Task',
              'parentId': 'ded66c29-a108-4040-8e4e-5c41277f3be8'},
             {'entityId': '21ab25fe-1326-11ed-8f22-226b2eaee502',
              'entityType': 'show',
              'entity_type': 'Project',
              'parentId': None},
             {'entityId': 'ded66c29-a108-4040-8e4e-5c41277f3be8',
              'entityType': 'task',
              'entity_type': 'Folder',
              'parentId': '2019772d-e121-4537-95a0-ec86503e6bcc'},
             {'entityId': '2019772d-e121-4537-95a0-ec86503e6bcc',
              'entityType': 'task',
              'entity_type': 'AssetBuild',
              'parentId': '61cd032f-398a-4e80-98e2-0d137519c7a6'},
             {'entityId': '61cd032f-398a-4e80-98e2-0d137519c7a6',
              'entityType': 'task',
              'entity_type': 'Folder',
              'parentId': '88d47da3-369b-4190-8de0-01c4b63b6c3d'},
             {'entityId': '88d47da3-369b-4190-8de0-01c4b63b6c3d',
              'entityType': 'task',
              'entity_type': 'Folder',
              'parentId': '6cd61c6c-1d46-4fb3-9ed8-740407ce22e4'},
             {'entityId': '6cd61c6c-1d46-4fb3-9ed8-740407ce22e4',
              'entityType': 'task',
              'entity_type': 'Folder',
              'parentId': '21ab25fe-1326-11ed-8f22-226b2eaee502'}]}



This is problematic for me because I was relying on parents[-1] being the project, while in this case the project is the second element of the list.
Is this a bug, or should I not expect the parents to be in order?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...