Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug where custom project code field wasn't being used on sync from Ayon to SG #67

Merged
merged 3 commits into from
Jan 25, 2024

Conversation

fabiaserra
Copy link
Contributor

The custom project code field was missing on this call:

    # Append the project's direct children.
    for ay_project_child in entity_hub._entities_by_parent_id[entity_hub.project_name]:
        ay_entities_deck.append((
            get_sg_entity_as_ay_dict(sg_session, "Project", sg_project["id"], project_code_field),
            ay_project_child
        ))

Although perhaps better than querying the sg_project again the best would be to append the existing sg_project variable that already exists on the function and contains the project code field, something like:

    # Append the project's direct children.
    for ay_project_child in entity_hub._entities_by_parent_id[entity_hub.project_name]:
        ay_entities_deck.append((
           _sg_to_ay_dict(sg_project, project_code_field)
            ay_project_child
        ))

@Minkiu thoughts?

@Minkiu
Copy link
Contributor

Minkiu commented Jan 23, 2024

The custom project code field was missing on this call:

    # Append the project's direct children.
    for ay_project_child in entity_hub._entities_by_parent_id[entity_hub.project_name]:
        ay_entities_deck.append((
            get_sg_entity_as_ay_dict(sg_session, "Project", sg_project["id"], project_code_field),
            ay_project_child
        ))

Although perhaps better than querying the sg_project again the best would be to append the existing sg_project variable that already exists on the function and contains the project code field, something like:

    # Append the project's direct children.
    for ay_project_child in entity_hub._entities_by_parent_id[entity_hub.project_name]:
        ay_entities_deck.append((
           _sg_to_ay_dict(sg_project, project_code_field)
            ay_project_child
        ))

@Minkiu thoughts?

That would probably work, we'd need to change the function to remove the leading _ but I get your point; although get_sg_entity_as_ay_dict will add more fields to the query, while the of sg_project might not have everything required...

@fabiaserra
Copy link
Contributor Author

That would probably work, we'd need to change the function to remove the leading _ but I get your point; although get_sg_entity_as_ay_dict will add more fields to the query, while the of sg_project might not have everything required...

Yeah I had the same thought, let's leave it like this then

@@ -43,8 +43,6 @@ def _sg_to_ay_dict(sg_entity: dict, project_code_field=None) -> dict:

if not label and not task_type:
raise ValueError(f"Unable to parse Task {sg_entity}")
else:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Minkiu this was overriding the label every time

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I though I was playing it safe... 🤦 thanks!

Copy link
Contributor

@Minkiu Minkiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution, merging!

@@ -162,7 +162,6 @@ def start_processing(self):
self.sg_url,
self.sg_script_name,
self.sg_api_key,
project_code_field=self.sg_project_code_field,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might as well delete it from line 45 since we are not using it any more, and we trust that it comes with the payload...

@@ -43,8 +43,6 @@ def _sg_to_ay_dict(sg_entity: dict, project_code_field=None) -> dict:

if not label and not task_type:
raise ValueError(f"Unable to parse Task {sg_entity}")
else:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I though I was playing it safe... 🤦 thanks!

@Minkiu Minkiu merged commit b160a33 into ynput:develop Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants