stalker.models.task.TimeLog¶
-
class
stalker.models.task.TimeLog(task=None, resource=None, start=None, end=None, duration=None, **kwargs)[source]¶ Bases:
stalker.models.entity.Entity,stalker.models.mixins.DateRangeMixinHolds information about the uninterrupted time spent on a specific
Taskby a specificUser.It is so important to note that the TimeLog reports the uninterrupted time interval 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 and 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
TimeLoginstance needs to be initialized with aTaskand aUserinstances.Adding overlapping time log for a
Userwill raise aOverBookedError.Parameters: -
__init__(task=None, resource=None, start=None, end=None, duration=None, **kwargs)¶
Methods
__init__([task, resource, start, end, duration])round_time(dt)Round the given datetime object to the defaults.timing_resolution. Attributes
computed_durationreturns the computed_duration as the difference of computed_start computed_endcomputed_startcomputed_total_secondsreturns the duration as seconds created_byThe Userwho has created this object.created_by_idThe id of the Userwho has created this entity.date_createdA datetime.datetimeinstance showing the creation date and time of this object.date_updatedA datetime.datetimeinstance showing the update date and time of this object.descriptionDescription of this object. durationDuration of the entity. endThe date that the entity should be delivered. entity_groupsentity_identity_typegeneric_dataThis attribute can hold any kind of data which exists in SOM. generic_textThis attribute can hold any text. html_classhtml_styleidmetadatanameName of this object nice_nameNice name of this object. notesAll the Notess attached to this entity.plural_class_namethe plural name of this class queryresourceThe Userinstance that this time_log is created forresource_idstartThe date that this entity should start. tagsA list of tags attached to this object. taskThe Taskinstance that this time log is created fortask_idThe id of the related task. thumbnailthumbnail_idtime_log_idtjp_idreturns TaskJuggler compatible id to_tjprenders a TaskJuggler compliant string used for TaskJuggler total_secondsreturns the duration as seconds typeThe type of the object. type_idThe id of the Typeof this entity.updated_byThe Userwho has updated this object.updated_by_idThe id of the Userwho has updated this entity.-
task_id¶ The id of the related task.
-
computed_duration¶ returns the computed_duration as the difference of computed_start and computed_end if there are computed_start and computed_end otherwise returns None
-
computed_total_seconds¶ returns the duration as seconds
-
date_created¶ A
datetime.datetimeinstance showing the creation date and time of this object.
-
date_updated¶ A
datetime.datetimeinstance showing the update date and time of this object.
-
description¶ Description of this object.
-
duration¶ Duration of the entity.
It is a datetime.timedelta instance. Showing the difference of the
startand theend. If edited it changes theendattribute value.
-
end¶ 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
-
generic_data¶ This attribute can hold any kind of data which exists in SOM.
-
generic_text¶ This attribute can hold any text.
-
name¶ Name of this object
-
nice_name¶ 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.
-
notes¶ All the
Notess attached to this entity.It is a list of
Noteinstances or an empty list, setting it to None will raise a TypeError.
-
plural_class_name¶ the plural name of this class
-
round_time(dt)¶ Round the given datetime object to the defaults.timing_resolution.
Uses
stalker.defaults.timing_resolutionas the closest number of seconds to round to.Parameters: dt (datetime.datetime) – datetime.datetime object, defaults to now. Based on Thierry Husson’s answer in Stackoverflow
Stackoverflow : http://stackoverflow.com/a/10854034/1431079
-
start¶ The date that this entity should start.
Also effects the
DateRangeMixin.endattribute value in certain conditions, if theDateRangeMixin.startis set to a time passing theDateRangeMixin.endit will also offset theDateRangeMixin.endto keep theDateRangeMixin.durationvalue fixed.DateRangeMixin.startshould be an instance of class:datetime.datetime and the default value isdatetime.datetime.now(pytz.utc)()
A list of tags attached to this object.
It is a list of
Taginstances which shows the tags of this object
-
tjp_id¶ returns TaskJuggler compatible id
-
to_tjp¶ renders a TaskJuggler compliant string used for TaskJuggler integration. Needs to be overridden in inherited classes.
-
total_seconds¶ returns the duration as seconds
-
type¶ The type of the object.
It is a
Typeinstance with a properType.target_entity_type.
-