Bases: object
Adds schedule info to the mixed in class.
Adds schedule information like start, end and duration. These attributes will be used in TaskJuggler. Because effort is only meaningful if there are some resources this attribute has been left special for Task class. The length has not been implemented because of its rare use.
The preceding order for the attributes is as follows:
start > end > duration
So if all of the parameters are given only the start and the end will be used and the duration will be calculated accordingly. In any other conditions the missing parameter will be calculated from the following table:
start | end | duration | DEFAULTS |
---|---|---|---|
start = datetime.datetime.now() duration = datetime.timedelta(days=10) end = start + duration |
|||
X | duration = datetime.timedelta(days=10) end = start + duration |
||
X | X | duration = end - start | |
X | X | end = start + duration | |
X | X | X | duration = end - start |
X | X | start = end - duration | |
X | duration = datetime.timedelta(days=10) start = end - duration |
||
X | start = datetime.datetime.now() end = start + duration |
Only the start, end will be stored. The duration attribute is the direct difference of the the start and end attributes, so there is no need to store it. But if will be used in calculation of the start and end values.
The start and end attributes have a computed companion. Which are the return values from TaskJuggler. so for start there is the computed_start and for end there is the computed_end attributes. These values are going to be used in Gantt Charts.
The date attributes can be managed with timezones. Follow the Python idioms shown in the documentation of datetime
Parameters: |
|
---|
Methods
__init__([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 | Represents a column in a database table. |
computed_start | Represents a column in a database table. |
computed_total_seconds | returns the duration as seconds |
duration | |
end | |
start | |
timing_resolution | |
total_seconds | returns the duration as seconds |
returns the computed_duration as the difference of computed_start and computed_end if there are computed_start and computed_end otherwise returns None
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