Bases: stalker.models.entity.Entity, stalker.models.mixins.ScheduleMixin
Holds information about the uninterrupted time spend on a specific Task by a specific User.
It is so important to note that the TimeLog reports the uninterrupted time that is spent for a Task. Thus it doesn’t care about the working time attributes like daily working hours, weekly working days or anything else. Again it is the uninterrupted time which is spent for a task.
Entering a time log for 2 days will book the resource for 48 hours not, 2 * daily working hours.
TimeLogs are created per resource. It means, you need to record all the works separately for each resource. So there is only one resource in a TimeLog instance.
A TimeLog instance needs to be initialized with a Task and a User instances.
Adding overlapping time log for a User will raise a OverBookedError.
TimeLog instances automatically extends the schedule_timing of the assigned Task if the total_logged_seconds is getting bigger than the schedule_timing after this TimeLog.
Parameters: |
---|
Methods
__init__([task, resource, start, end, duration]) | |
round_time(dt) | Round a datetime object to any time laps in seconds. |
Attributes
computed_duration | returns the computed_duration as the difference of computed_start |
computed_end | |
computed_start | |
computed_total_seconds | returns the duration as seconds |
created_by | The User who has created this object. |
created_by_id | The id of the User who has created |
date_created | A datetime.datetime instance showing the creation date and time of this object. |
date_updated | A datetime.datetime instance showing the update date and time of this object. |
description | Description of this object. |
duration | Duration of the entity. |
end | The date that the entity should be delivered. |
entity_id | |
entity_type | |
generic_data | This attribute can hold any kind of data which exists in SOM. |
id | |
metadata | A collection of Table objects and their associated schema |
name | Name of this object |
nice_name | Nice name of this object. |
notes | All the Notess attached to this entity. |
plural_class_name | the plural name of this class |
query | ORM-level SQL construction object. |
resource | The User instance that this |
resource_id | |
start | The date that this entity should start. |
tags | A list of tags attached to this object. |
task | The Task instance that this |
task_id | |
thumbnail | |
thumbnail_id | |
time_log_id | |
timing_resolution | The timing_resolution of this object. |
tjp_id | returns TaskJuggler compatible id |
to_tjp | renders a TaskJuggler compliant string used for TaskJuggler |
total_seconds | returns the duration as seconds |
type | The type of the object. |
type_id | The id of the Type of this entity. |
updated_by | The User who has updated this object. |
updated_by_id | The id of the User who has updated |
returns the computed_duration as the difference of computed_start and computed_end if there are computed_start and computed_end otherwise returns None
returns the duration as seconds
A datetime.datetime instance showing the creation date and time of this object.
A datetime.datetime instance showing the update date and time of this object.
Description of this object.
Duration of the entity.
It is a datetime.timedelta instance. Showing the difference of the start and the end. If edited it changes the end attribute value.
The date that the entity should be delivered.
The end can be set to a datetime.timedelta and in this case it will be calculated as an offset from the start and converted to datetime.datetime again. Setting the start to a date passing the end will also set the end, so the timedelta between them is preserved, default value is 10 days
This attribute can hold any kind of data which exists in SOM.
Name of this object
Nice name of this object.
It has the same value with the name (contextually) but with a different format like, all the white spaces replaced by underscores (“_”), all the CamelCase form will be expanded by underscore (_) characters and it is always lower case.
All the Notess attached to this entity.
It is a list of Note instances or an empty list, setting it None will raise a TypeError.
the plural name of this class
Round a datetime object to any time laps in seconds.
Uses class property timing_resolution as the closest number of seconds to round to, defaults 1 hour.
Parameters: | dt – datetime.datetime object, defaults now. |
---|
Based on Thierry Husson’s answer in Stackoverflow
Stackoverflow : http://stackoverflow.com/a/10854034/1431079
The date that this entity should start.
Also effects the end attribute value in certain conditions, if the start is set to a time passing the end it will also offset the end to keep the duration value fixed. start should be an instance of class:datetime.datetime and the default value is datetime.datetime.now()
A list of tags attached to this object.
It is a list of Tag instances which shows the tags of this object
The timing_resolution of this object.
Can be set to any value that is representable with datetime.timedelta. The default value is 1 hour. Whenever it is changed the start, end and duration values will be updated.
returns TaskJuggler compatible id
renders a TaskJuggler compliant string used for TaskJuggler integration. Needs to be overridden in inherited classes.
returns the duration as seconds
The type of the object.
It is an instance of Type with a proper target_entity_type.