Class Shift is a scheduled working time period, and can include breaks.
More...
|
def | __init__ (self, str name, str description, time start, timedelta duration) |
| Construct a shift definition. More...
|
|
def | addBreak (self, Break breakPeriod) |
| Add a break period to this shift. More...
|
|
def | removeBreak (self, Break breakPeriod) |
| Remove a break from this shift. More...
|
|
Break | createBreak (self, str name, str description, time startTime, timedelta duration) |
| Create a break for this shift. More...
|
|
timedelta | calculateWorkingTime (self, time fromTime, time toTime) |
| Calculate the working time between the specified times of day. More...
|
|
bool | spansMidnight (self) |
| Check to see if this shift crosses midnight. More...
|
|
timedelta | calculateTotalWorkingTime (self, time fromTime, time toTime, bool beforeMidnight) |
| Calculate the working time between the specified times of day. More...
|
|
bool | isInShift (self, time time) |
| Test if the specified time falls within the shift. More...
|
|
timedelta | calculateBreakTime (self) |
| Calculate the total break time for the shift. More...
|
|
bool | isWorkingPeriod (self) |
| a shift is a working period
|
|
str | __str__ (self) |
|
Class Shift is a scheduled working time period, and can include breaks.
◆ __init__()
def shift.Shift.__init__ |
( |
|
self, |
|
|
str |
name, |
|
|
str |
description, |
|
|
time |
start, |
|
|
timedelta |
duration |
|
) |
| |
Construct a shift definition.
- Parameters
-
name | Name of shift |
description | Description of shift |
start | Starting time of day |
duration | Duration of shift |
◆ addBreak()
def shift.Shift.addBreak |
( |
|
self, |
|
|
Break |
breakPeriod |
|
) |
| |
Add a break period to this shift.
- Parameters
-
◆ calculateBreakTime()
timedelta shift.Shift.calculateBreakTime |
( |
|
self | ) |
|
Calculate the total break time for the shift.
- Returns
- duration of all breaks
◆ calculateTotalWorkingTime()
timedelta shift.Shift.calculateTotalWorkingTime |
( |
|
self, |
|
|
time |
fromTime, |
|
|
time |
toTime, |
|
|
bool |
beforeMidnight |
|
) |
| |
Calculate the working time between the specified times of day.
- Parameters
-
fromTime | starting time |
toTime | Ending time |
- Returns
- timedelta working time
- Parameters
-
beforeMidnight | If true, and a shift spans midnight, calculate the time before midnight. Otherwise calculate the time after midnight. |
- Returns
- timedelta working time
◆ calculateWorkingTime()
timedelta shift.Shift.calculateWorkingTime |
( |
|
self, |
|
|
time |
fromTime, |
|
|
time |
toTime |
|
) |
| |
Calculate the working time between the specified times of day.
The shift must not span midnight.
- Parameters
-
fromTime | starting time |
toTime | Ending time |
- Returns
- timedelta working time
◆ createBreak()
Break shift.Shift.createBreak |
( |
|
self, |
|
|
str |
name, |
|
|
str |
description, |
|
|
time |
startTime, |
|
|
timedelta |
duration |
|
) |
| |
Create a break for this shift.
- Parameters
-
name | Name of break |
description | Description of break |
startTime | Start of break |
duration | of break |
- Returns
- Break
◆ isInShift()
bool shift.Shift.isInShift |
( |
|
self, |
|
|
time |
time |
|
) |
| |
Test if the specified time falls within the shift.
- Parameters
-
- Returns
- True if the time is in the shift
◆ removeBreak()
def shift.Shift.removeBreak |
( |
|
self, |
|
|
Break |
breakPeriod |
|
) |
| |
Remove a break from this shift.
- Parameters
-
◆ spansMidnight()
bool shift.Shift.spansMidnight |
( |
|
self | ) |
|
Check to see if this shift crosses midnight.
- Returns
- True if the shift extends over midnight, otherwise False
The documentation for this class was generated from the following file: