mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
app launch changes status if current status is same as in config 'statuses_name_change'
This commit is contained in:
parent
886c55a0c0
commit
af3a918f24
1 changed files with 22 additions and 6 deletions
|
|
@ -345,19 +345,35 @@ class AppAction(object):
|
||||||
}
|
}
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# RUN TIMER IN FTRACK
|
# RUN TIMER IN FTRACK
|
||||||
username = event['source']['user']['username']
|
username = event['source']['user']['username']
|
||||||
user = session.query('User where username is "{}"'.format(username)).one()
|
query_user = 'User where username is "{}"'.format(username)
|
||||||
task = session.query('Task where id is {}'.format(entity['id'])).one()
|
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'])
|
self.log.info('Starting timer for task: ' + task['name'])
|
||||||
user.start_timer(task, force=True)
|
user.start_timer(task, force=True)
|
||||||
|
|
||||||
# Change status of task to In progress
|
# Change status of task to In progress
|
||||||
config = ftrack_utils.get_config_data()
|
config = ftrack_utils.get_config_data()
|
||||||
statuses = config['sync_to_avalon']['statuses_name_change']
|
|
||||||
status = config['status_on_app_launch']
|
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 {
|
return {
|
||||||
'success': True,
|
'success': True,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue