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

Syncing task types syncs as 'short_name' instead of 'shortName' in project #72

Open
2 tasks done
BigRoy opened this issue Aug 29, 2024 · 1 comment
Open
2 tasks done
Labels
type: bug Something isn't working

Comments

@BigRoy
Copy link
Contributor

BigRoy commented Aug 29, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior:

It seems that new task types sync to AYON as:

{'name': 'TestType', 'short_name': 'Test'} 

So it doesn't contain the shortName key
But that should be:

{'name': 'TestType', 'shortName': 'Test'}

This breaks the launcher:

Traceback (most recent call last):
  File "C:\Users\joseph.henry\AppData\Local\Ynput\AYON\addons\core_0.4.3\ayon_core\tools\utils\lib.py", line 444, in run
    self._result = self._callback()
  File "C:\Users\joseph.henry\AppData\Local\Ynput\AYON\addons\core_0.4.3\ayon_core\tools\utils\tasks_widget.py", line 198, in _thread_getter
    task_type_items = self._controller.get_task_type_items(
  File "C:\Users\joseph.henry\AppData\Local\Ynput\AYON\addons\core_0.4.3\ayon_core\tools\launcher\control.py", line 68, in get_task_type_items
    return self._projects_model.get_task_type_items(
  File "C:\Users\joseph.henry\AppData\Local\Ynput\AYON\addons\core_0.4.3\ayon_core\tools\common_models\projects.py", line 357, in get_task_type_items
    return self._get_project_items(
  File "C:\Users\joseph.henry\AppData\Local\Ynput\AYON\addons\core_0.4.3\ayon_core\tools\common_models\projects.py", line 380, in _get_project_items
    cache_value = getter(self.get_project_entity(project_name))
  File "C:\Users\joseph.henry\AppData\Local\Ynput\AYON\addons\core_0.4.3\ayon_core\tools\common_models\projects.py", line 454, in _task_type_items_getter
    return [
  File "C:\Users\joseph.henry\AppData\Local\Ynput\AYON\addons\core_0.4.3\ayon_core\tools\common_models\projects.py", line 455, in <listcomp>
    TaskTypeItem.from_project_item(task_type)
  File "C:\Users\joseph.henry\AppData\Local\Ynput\AYON\addons\core_0.4.3\ayon_core\tools\common_models\projects.py", line 138, in from_project_item
    short=task_type_data["shortName"],
KeyError: 'shortName'

Expected Behavior:

Syncing shouldn't break AYON.

Version

1.0.0

What platform you are running on?

Windows

Steps To Reproduce:

  1. Created a new task type in Kitsu, added it to a newly created shot
  2. Sync the project in Ayon admin interface
  3. Open the launcher and click on a tree object

Are there any labels you wish to add?

  • I have added the relevant labels to the bug report.

Relevant log output:

No response

Additional context:

See discord discussion here https://discord.com/channels/517362899170230292/1278648431338065992

Note There also appears to be logic that makes the short name, however that logic would fail if the long name is shorter than four characters. Here:

"""#TODO: kitsu listener for new task types would be preferable"""
if task_type_name not in [task_type["name"] for task_type in project.task_types]:
logging.info(f"Creating task type {task_type_name} for '{project.name}'")
project.task_types.append(
{
"name": task_type_name,
"short_name": task_type_name[:4],
}
)
await project.save()
return True
return False

@BigRoy BigRoy added the type: bug Something isn't working label Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants
@BigRoy and others