Jump to content

Available Tasks


eight

Recommended Posts

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

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

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

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

  • 2 weeks later...

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...