Jump to content

Tracking time out of project period


laura.c

Recommended Posts

Posted

Hi guys,

 

The users can track time on a project out of project period. Is there any way not to allowed that?

For eg. disable the text box for time tracking in Timesheet?

 

Thanks,

Laura

Posted

Hi Carl,

 

Thanks for your answer.

 

I am thinking of another solution: I try to define an action on 'update' event, so, every time when the user tries to track time out of the project period, the input value will be switched to 0.

 

But I can't find a way to update the 'hours' field in a timeReports object and refresh the web ui . Any suggestions?

 

Thanks!

Laura

Posted

Hi Laura,

 

Are you running version 2 of ftrack?

 

You should be able to listen on the update event and set the value to 0 if out of the project dates. Refreshing the web interface from the API is currently not possible.

 

Here is an quick example resetting time reports if the date is not within the project start and end.

import ftrackftrack.setup()def validate_time_report(topic, **kw):    '''Event callback to validate time reports.'''    entities = kw.get('entities', [])    for entity in entities:        if entity['entityType'] == 'taskworkedhours':            parent = ftrack.Task(entity['parents'][1]['entityId'])            project = parent.getProject()            reports = parent.getTimereports()            for report in reports:                if (                    report.get('date') < project.get('startdate') or                    report.get('date') > project.get('enddate')                ):                    report.set('hours', 0)# Subscribe to the update topic.ftrack.TOPICS.subscribe('update', validate_time_report)ftrack.TOPICS.wait()

Note that in ftrack 3 the API interface for handling timereports has changed.

 

Cheers,

Carl

Posted

Hi Carl,

 

 

Thanks for the code. Very helpful!!!

 

Yes, we are using ftrack 2.

 

Refreshing web interface from API would be very helpful since we would like to implement actions when tasks/shots/asset builds are created/renamed for validating the names. Is it possible in ftrack 3?

 

 

 

Cheers,

Laura

Posted

Hi Laura,

 

At the moment it is not possible to send messages from the API, but you could post a note on the entity the user tries to log time on and add the user as recipient. This way the user will get a notification in their inbox.

 

Let me know what you think.

 

Regards,

Carl

Archived

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

×
×
  • Create New...