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

Status update on application launch is not case sensitive #75

Merged
merged 1 commit into from
Feb 5, 2024
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
21 changes: 11 additions & 10 deletions client/ayon_ftrack/launch_hooks/post_ftrack_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,24 +114,27 @@ def ftrack_status_change(self, session, entity, project_name):
)
return

actual_status = entity["status"]["name"].lower()
current_status = entity["status"]["name"].lower()
already_tested = set()
ent_path = "/".join(
[ent["name"] for ent in entity["link"]]
)

statuses = session.query(f"select id, name from Status").all()
statuses_by_low_name = {
status["name"].lower(): status
for status in statuses
}
# TODO refactor
while True:
next_status_name = None
for item in status_mapping:
new_status = item["name"]
new_status = item["name"].lower()
if new_status in already_tested:
continue

from_statuses = item["value"]
if (
actual_status in from_statuses
or "__any__" in from_statuses
):
from_statuses = item["value"].lower()
if from_statuses in (current_status, "__any__"):
if new_status != "__ignore__":
next_status_name = new_status
already_tested.add(new_status)
Expand All @@ -141,9 +144,7 @@ def ftrack_status_change(self, session, entity, project_name):
if next_status_name is None:
break

status = session.query(
f"Status where name is \"{next_status_name}\""
).first()
status = statuses_by_low_name.get(next_status_name)
if status is None:
self.log.warning(
f"Status '{next_status_name}' not found in ftrack."
Expand Down