eight Posted June 21, 2014 Report Share Posted June 21, 2014 Hello,What's the best way to get available tasks? I can search for tasks with an empty user list + NOT_STARTED state, but this isn't completely accurate. This still pulls in too many tasks because people who aren't assigned to the task type in the planning stage shouldn't be able to see it.Also a side note: When I use Project.getTasks() using users=[] as a parameter returns all tasks instead of ones without users assigned. Link to comment Share on other sites More sharing options...
Mattias Seebergs Posted June 23, 2014 Report Share Posted June 23, 2014 Hi, Currently the best way is to get all tasks on all entities and do the filtering. I would liked to have said that there was a way to filter directly on the database query but there is not at the moment. We are however planning to improve this and make some sort of query API in the future. The getTasks() method is unfortunately not designed to work that way even if that would be logical. I will talk to the team to see what they think. Link to comment Share on other sites More sharing options...
eight Posted June 23, 2014 Author Report Share Posted June 23, 2014 Okay, good to know.I was looking into the Phase class and it doesn't seem to have any way of accessing the TaskTypes which I'll need to filter available tasks. Link to comment Share on other sites More sharing options...
eight Posted July 1, 2014 Author Report Share Posted July 1, 2014 I still haven't found a way to filter Available Tasks because I keep hitting dead ends. It's including things like Milestones, but they're returned as Task objects. If it's not too much to ask, could you provide an example? Link to comment Share on other sites More sharing options...
Mattias Seebergs Posted July 1, 2014 Report Share Posted July 1, 2014 Here is an example. Let me know if you have any further questions.import ftrack# Get projectproject = ftrack.getProject('Piggy')# Iterate over all tasks on the project with state NOT_STARTEDfor task in project.getTasks(includeChildren=True, states=['NOT_STARTED']): # Run if task startdate is same as task enddate if not (task.get('startdate') and (task.get('startdate') == task.get('enddate'))): # Get a list of all users on the task users = task.getUsers() # Run if users is not empty if not users: print task Link to comment Share on other sites More sharing options...
eight Posted July 12, 2014 Author Report Share Posted July 12, 2014 Sorry, took me a while to respond.Thank you for the example. However, my results are different than what appears in 'My Tasks' in the browser. For example, a Task with a 'Hair' type will show up for the ftrack API, but not for the web interface. This is because I'm not assigned to the 'Hair' task type in the Planning section. I don't know how to check if I'm assigned to the proper Task Types. Link to comment Share on other sites More sharing options...
Mattias Seebergs Posted July 14, 2014 Report Share Posted July 14, 2014 You can use the getUsers() method on a phase object to get all users assigned to a specific phase. You can also get all phases on a project with the getPhases() method on a project object. Let me know how you get on and if you have further questions. Link to comment Share on other sites More sharing options...
eight Posted July 15, 2014 Author Report Share Posted July 15, 2014 Your suggestion does remove tasks that aren't assigned to the user in the planning stage, but I still have the issue of getting Task Types that aren't assigned to the user in Planning. For some reason there is no Phase.getTaskTypes() method from what I can see. I still get 'Hair' type tasks when I'm not assigned to them. Link to comment Share on other sites More sharing options...
Mattias Seebergs Posted July 15, 2014 Report Share Posted July 15, 2014 I see, sorry. No there is no getTaskTypes() method. I have added a feature request ticket on adding that method. We will keep you updated in this thread. Link to comment Share on other sites More sharing options...
eight Posted July 15, 2014 Author Report Share Posted July 15, 2014 Okay, thanks for doing that. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.