mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
Merged in feature/PYPE-134_app_changes_status (pull request #43)
Feature/PYPE-134 app changes status Approved-by: Milan Kolar <milan@orbi.tools>
This commit is contained in:
commit
31f8ac18e6
1 changed files with 26 additions and 5 deletions
|
|
@ -10,7 +10,7 @@ import toml
|
|||
from avalon import io, lib, pipeline
|
||||
from avalon import session as sess
|
||||
import acre
|
||||
|
||||
from pype.ftrack import ftrack_utils
|
||||
|
||||
from pype import api as pype
|
||||
|
||||
|
|
@ -345,15 +345,36 @@ class AppAction(object):
|
|||
}
|
||||
pass
|
||||
|
||||
|
||||
|
||||
# RUN TIMER IN FTRACK
|
||||
username = event['source']['user']['username']
|
||||
user = session.query('User where username is "{}"'.format(username)).one()
|
||||
task = session.query('Task where id is {}'.format(entity['id'])).one()
|
||||
query_user = 'User where username is "{}"'.format(username)
|
||||
query_task = 'Task where id is {}'.format(entity['id'])
|
||||
user = session.query(query_user).one()
|
||||
task = session.query(query_task).one()
|
||||
self.log.info('Starting timer for task: ' + task['name'])
|
||||
user.start_timer(task, force=True)
|
||||
|
||||
# Change status of task to In progress
|
||||
config = ftrack_utils.get_config_data()
|
||||
|
||||
if (
|
||||
'status_on_app_launch' in config and
|
||||
'sync_to_avalon' in config and
|
||||
'statuses_name_change' in config['sync_to_avalon']
|
||||
):
|
||||
statuses = config['sync_to_avalon']['statuses_name_change']
|
||||
if entity['status']['name'].lower() in statuses:
|
||||
status_name = config['status_on_app_launch']
|
||||
|
||||
try:
|
||||
query = 'Status where name is "{}"'.format(status_name)
|
||||
status = session.query(query).one()
|
||||
task['status'] = status
|
||||
session.commit()
|
||||
except Exception as e:
|
||||
msg = "Status '{}' in config wasn't found on Ftrack".format(status_name)
|
||||
self.log.warning(msg)
|
||||
|
||||
return {
|
||||
'success': True,
|
||||
'message': "Launching {0}".format(self.label)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue