Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Ftrack: Fill missing ftrack id on mongo project #2203

Merged
merged 1 commit into from
Nov 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ def avalon_ents_by_ftrack_id(self):
self._avalon_ents_by_ftrack_id = {}
proj, ents = self.avalon_entities
if proj:
ftrack_id = proj["data"]["ftrackId"]
ftrack_id = proj["data"].get("ftrackId")
if ftrack_id is None:
ftrack_id = self._update_project_ftrack_id()
self._avalon_ents_by_ftrack_id[ftrack_id] = proj
for ent in ents:
ftrack_id = ent["data"].get("ftrackId")
Expand All @@ -202,6 +204,16 @@ def avalon_ents_by_ftrack_id(self):
self._avalon_ents_by_ftrack_id[ftrack_id] = ent
return self._avalon_ents_by_ftrack_id

def _update_project_ftrack_id(self):
ftrack_id = self.cur_project["id"]

self.dbcon.update_one(
{"type": "project"},
{"$set": {"data.ftrackId": ftrack_id}}
)

return ftrack_id

@property
def avalon_subsets_by_parents(self):
if self._avalon_subsets_by_parents is None:
Expand Down