Schedule¶
-
class
moco_wrapper.models.
Schedule
(moco)¶ Class for handling user schedules (Old Planning and Absences).
Note
For handling planning the new way, use the
moco_wrapper.models.PlanningEntry
-
create
(schedule_date: datetime.date, project_id: int = None, absence_code: moco_wrapper.models.schedule.ScheduleAbsenceCode = None, user_id: int = None, am: bool = None, pm: bool = None, comment: str = None, symbol: moco_wrapper.models.schedule.ScheduleSymbol = None, overwrite: bool = None)¶ Create a new schedule entry.
Parameters: - schedule_date (datetime.date, str) – date of the entry
- project_id (int) – Project id
- absence_code (
ScheduleAbsenceCode
, int) – Type of absence - user_id (int) – User id
- am (bool) – Morning yes/no
- pm (bool) – Afternoon yes/no
- comment (str) – Comment text
- symbol (
ScheduleSymbol
, int) – Symbol to use for the schedule item - overwrite (bool) – yes/no overwrite existing entry
Returns: The created planning entry
Note
Define either
project_id
ORabsence_code
, specify one, not both.
-
delete
(schedule_id: int)¶ Delete a schedule entry.
Parameters: schedule_id (int) – Id of the entry to delete Returns: The deleted schedule object
-
get
(schedule_id: int)¶ Retrieve a single schedule object.
Parameters: schedule_id (int) – Id of the entry Returns: Single schedule object
-
getlist
(from_date: datetime.date = None, to_date: datetime.date = None, user_id: int = None, project_id: int = None, absence_code: moco_wrapper.models.schedule.ScheduleAbsenceCode = None, sort_by: str = None, sort_order: str = 'asc', page=1)¶ Retrieve all planned schedule items.
Parameters: - from_date (datetime.date, str) – Start date
- to_date (datetime.date, str) – End date
- user_id (int) – user id the planned entries are belonging to
- project_id (int) – project id
- absence_code (
ScheduleAbsenceCode
, int) – Type of absence - sort_by (str) – Field to sort the results by
- sort_order (str) – asc or desc (default asc)
- page (int) – Page number (default 1)
Returns: List of schedule objects
-
update
(schedule_id: int, project_id: int = None, absence_code: moco_wrapper.models.schedule.ScheduleAbsenceCode = None, am: bool = None, pm: bool = None, comment: str = None, symbol: moco_wrapper.models.schedule.ScheduleSymbol = None, overwrite: bool = None)¶ Update a schedule entry.
Parameters: - schedule_id (int) – Id of the entry to update
- project_id (int) – Project id
- absence_code (
ScheduleAbsenceCode
, int) – Type of absence - am (bool) – Morning yes/no
- pm (bool) – Afternoon yes/no
- comment (str) – Comment text
- symbol (
ScheduleSymbol
, str) – Symbol to use for the schedule item - overwrite (bool) – yes/no overwrite existing entry
Returns: The updated schedule entry
Note
Define either
project_id
ORabsence_code
, specify one, not both.
-
-
class
moco_wrapper.models.schedule.
ScheduleAbsenceCode
¶ Enumeration for allowed values of argument
absence_code
ofSchedule.getlist()
,Schedule.create()
andSchedule.update()
from moco_wrapper.models.schedule import ScheduleAbsenceCode from moco_wrapper import Moco m = Moco() new_schedule = m.Schedule.create( .. absence_code = ScheduleAbsenceCode.SICK_DAY )
-
ABSENCE
= 5¶
-
HOLIDAY
= 4¶
-
PUBLIC_HOLIDAY
= 2¶
-
SICK_DAY
= 3¶
-
UNPLANNED
= 1¶
-
-
class
moco_wrapper.models.schedule.
ScheduleSymbol
¶ Enumeration for allowed values of argument
symbol
ofSchedule.create()
andSchedule.update()
from moco_wrapper.models.schedule import ScheduleSymbol from moco_wrapper import Moco m = Moco() new_schedule = m.Schedule.create( .. symbol = ScheduleSymbol.HOME )
-
BABY_CARRIAGE
= 7¶
-
BELLS
= 6¶
-
BUILDING
= 2¶
-
CAR
= 3¶
-
COCKTAIL
= 5¶
-
GRADUATION_CAP
= 4¶
-
HOME
= 1¶
-
INFO_CIRCLE
= 10¶
-
MOON
= 9¶
-
USERS
= 8¶
-