moving TimeLogs
1 1

5 posts in this topic

I want to move all the timelogs from one task to another task in another project because I want to recreate a project with a dedicated project schema. If I could just change the schema using the new python API that would be great but I think that's not possible so I just created a new project and created new tasks in the browser. But now I want to move timelogs to the new tasks so I can remove the old project from ftrack.

My first thought was to just get a timelog from the old task, then append it to the new task's timelogs. But since a TimeLog references a specific context_id I don't know if that's wise or even supported. I wanted to ask how to do it before I do something that might mess with the database in unintended ways:

  for timelog in old_task["timelogs"]:
      new_task["timelogs"].append(timelog)

 

Share this post


Link to post
Share on other sites
On 10/03/2017 at 10:38 AM, Tilt said:

  for timelog in old_task["timelogs"]:
      new_task["timelogs"].append(timelog)

I think the safest approach is to update the context_id:

for timelog in old_task["timelogs"]:
    timelog['context_id'] = new_task['id']

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
1 1