(20260309) Added new 'mode' for formatting the muster roll'.
This commit is contained in:
+13
-7
@@ -604,7 +604,7 @@ class AsyncTheCAOffice:
|
||||
async def attendance_mark(
|
||||
self,
|
||||
user_id: int,
|
||||
status: Literal["P", "H", "A", "OT"],
|
||||
status: Literal["A", "H", "HD1", "HD2", "P", "OT"],
|
||||
over_time: int | float,
|
||||
attendance_date: datetime.datetime | None = None,
|
||||
json_notes: dict = None,
|
||||
@@ -615,10 +615,12 @@ class AsyncTheCAOffice:
|
||||
Add a new department.
|
||||
:param user_id: The id of the user whose attendance is being marked.
|
||||
:param status: The status of the attendance.
|
||||
1. "P" for present,
|
||||
2. "H" for half-day,
|
||||
3. "A" for absent,
|
||||
4. "OT" for over-time.
|
||||
1. "A" for absent,
|
||||
2. "H" for holiday,
|
||||
3. "HD1" for half-day (1st half),
|
||||
4. "HD2" for half-day (2nd half),
|
||||
5. "P" for present,
|
||||
6. "OT" for over-time.
|
||||
:param over_time: The amount of over-time work in hours.
|
||||
:param attendance_date: The date of the attendance. If not given, today's date will be used.
|
||||
:param json_notes: Optional notes about the attendance.
|
||||
@@ -683,6 +685,7 @@ class AsyncTheCAOffice:
|
||||
async def attendance_register(
|
||||
self,
|
||||
target_month: datetime.datetime,
|
||||
mode: Literal["month", "date"] = "month",
|
||||
raise_exception: bool = False,
|
||||
) -> List[dict] | None:
|
||||
|
||||
@@ -690,6 +693,7 @@ class AsyncTheCAOffice:
|
||||
To get the whole attendance register for a month for all the employees of an entity.
|
||||
:param target_month: The datetime which indicates the year and month in which the attendance needs to be
|
||||
checked.
|
||||
:param mode: The mode of the attendance filtering.
|
||||
:param raise_exception: Whether to raise any exceptions, or to suppress them.
|
||||
:return: The attendance register records if successful, else None.
|
||||
"""
|
||||
@@ -700,11 +704,13 @@ class AsyncTheCAOffice:
|
||||
try:
|
||||
|
||||
# Make the API call:
|
||||
json_payload = {"month": target_month.strftime("%Y-%m-%d")}
|
||||
response = await self._http_client.post(
|
||||
url = self.ATTENDANCE_REGISTER_URL,
|
||||
headers = {"X-Session-Token": self.__session_token},
|
||||
json = json_payload,
|
||||
json = {
|
||||
"month": target_month.strftime("%Y-%m-%d"),
|
||||
"mode": mode
|
||||
},
|
||||
)
|
||||
|
||||
# If the call succeeded:
|
||||
|
||||
Reference in New Issue
Block a user