From 45d5c05f1a915779af30a04fcdbc908e85b41955 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 15 Aug 2019 10:56:11 +0200 Subject: [PATCH] removed clockify from Ftrack start.timer action --- pype/ftrack/actions/action_start_timer.py | 54 ++++------------------- 1 file changed, 9 insertions(+), 45 deletions(-) diff --git a/pype/ftrack/actions/action_start_timer.py b/pype/ftrack/actions/action_start_timer.py index ad83edfc9e..558687537d 100644 --- a/pype/ftrack/actions/action_start_timer.py +++ b/pype/ftrack/actions/action_start_timer.py @@ -19,55 +19,19 @@ class StartTimer(BaseAction): entity = entities[0] if entity.entity_type.lower() != 'task': return - self.start_ftrack_timer(entity) - try: - self.start_clockify_timer(entity) - except Exception: - self.log.warning( - 'Failed starting Clockify timer for task: ' + entity['name'] - ) - return - def start_ftrack_timer(self, task): - user_query = 'User where username is "{}"'.format(self.session.api_user) - user = self.session.query(user_query).one() - self.log.info('Starting Ftrack timer for task: ' + task['name']) + user = self.session.query( + "User where username is \"{}\"".format(self.session.api_user) + ).one() + user.start_timer(task, force=True) self.session.commit() - - def start_clockify_timer(self, task): - # Validate Clockify settings if Clockify is required - clockify_timer = os.environ.get('CLOCKIFY_WORKSPACE', None) - if clockify_timer is None: - return - - from pype.clockify import ClockifyAPI - clockapi = ClockifyAPI() - if clockapi.verify_api() is False: - return - task_type = task['type']['name'] - project_name = task['project']['full_name'] - - def get_parents(entity): - output = [] - if entity.entity_type.lower() == 'project': - return output - output.extend(get_parents(entity['parent'])) - output.append(entity['name']) - - return output - - desc_items = get_parents(task['parent']) - desc_items.append(task['name']) - description = '/'.join(desc_items) - - project_id = clockapi.get_project_id(project_name) - tag_ids = [] - tag_ids.append(clockapi.get_tag_id(task_type)) - clockapi.start_time_entry( - description, project_id, tag_ids=tag_ids + + self.log.info( + "Starting Ftrack timer for task: {}".format(entity['name']) ) - self.log.info('Starting Clockify timer for task: ' + task['name']) + + return def register(session, plugins_presets={}):