@@ -2054,28 +2054,28 @@ def wait_until_job_is_executable(
2054
2054
# Public Method : Labor Control
2055
2055
#########################################
2056
2056
@staticmethod
2057
- def _get_actual_worktime_hour_from_labor (labor : Dict [str , Any ]) -> Optional [ float ] :
2057
+ def _get_actual_worktime_hour_from_labor (labor : Dict [str , Any ]) -> float :
2058
2058
working_time_by_user = labor ["values" ]["working_time_by_user" ]
2059
2059
if working_time_by_user is None :
2060
- return None
2060
+ return 0
2061
2061
2062
2062
actual_worktime = working_time_by_user .get ("results" )
2063
2063
if actual_worktime is None :
2064
- return None
2064
+ return 0
2065
2065
else :
2066
2066
return actual_worktime / 3600 / 1000
2067
2067
2068
2068
@staticmethod
2069
- def _get_plan_worktime_hour_from_labor (labor : Dict [str , Any ]) -> Optional [ float ] :
2069
+ def _get_plan_worktime_hour_from_labor (labor : Dict [str , Any ]) -> float :
2070
2070
working_time_by_user = labor ["values" ]["working_time_by_user" ]
2071
2071
if working_time_by_user is None :
2072
- return None
2072
+ return 0
2073
2073
2074
- actual_worktime = working_time_by_user .get ("plans" )
2075
- if actual_worktime is None :
2076
- return None
2074
+ plan_worktime = working_time_by_user .get ("plans" )
2075
+ if plan_worktime is None :
2076
+ return 0
2077
2077
else :
2078
- return actual_worktime / 3600 / 1000
2078
+ return plan_worktime / 3600 / 1000
2079
2079
2080
2080
@staticmethod
2081
2081
def _get_working_description_from_labor (labor : Dict [str , Any ]) -> Optional [str ]:
@@ -2097,6 +2097,8 @@ def get_labor_control_worktime(
2097
2097
実績作業時間(actual_worktime)と予定作業時間(plan_worktime)を扱いやすいフォーマットで取得する。
2098
2098
ただし、organization_id または project_id のいずれかを指定する必要がある。
2099
2099
2100
+ .. deprecated:: 2022-02-01 以降に削除する予定です
2101
+
2100
2102
Args:
2101
2103
organization_id: 絞り込み対象の組織ID
2102
2104
project_id: 絞り込み対象のプロジェクトID
@@ -2112,8 +2114,9 @@ def get_labor_control_worktime(
2112
2114
* date
2113
2115
* actual_worktime:実績作業時間[hour]
2114
2116
* plan_worktime:予定作業時間[hour]
2115
- * working_description:実績に関するコメント
2117
+ * working_description:実績に関するコメント(optional)
2116
2118
"""
2119
+ warnings .warn ("deprecated" , FutureWarning )
2117
2120
2118
2121
def _to_new_data (labor : Dict [str , Any ]) -> Dict [str , Any ]:
2119
2122
labor ["actual_worktime" ] = self ._get_actual_worktime_hour_from_labor (labor )
@@ -2134,7 +2137,7 @@ def _to_new_data(labor: Dict[str, Any]) -> Dict[str, Any]:
2134
2137
}
2135
2138
try :
2136
2139
labor_list , _ = self .api .get_labor_control (query_params )
2137
- return [_to_new_data (e ) for e in labor_list ]
2140
+ return [_to_new_data (elm ) for elm in labor_list if elm [ "account_id" ] is not None ]
2138
2141
except requests .HTTPError as e :
2139
2142
# "502 Server Error"が発生するときは、取得するレスポンスが大きすぎる可能性があるので、取得期間を分割する。
2140
2143
# ただし、取得する期間が指定されている場合のみ
@@ -2180,6 +2183,8 @@ def get_labor_control_availability(
2180
2183
"""
2181
2184
労務管理の予定稼働時間を取得する。
2182
2185
2186
+ .. deprecated:: 2022-02-01 以降に削除する予定です
2187
+
2183
2188
Args:
2184
2189
account_id: 絞り込み対象のアカウントID
2185
2190
from_date: 絞り込み対象の開始日(YYYY-MM-DD)
@@ -2191,6 +2196,7 @@ def get_labor_control_availability(
2191
2196
* date
2192
2197
* availability:予定稼働時間[hour]
2193
2198
"""
2199
+ warnings .warn ("deprecated" , FutureWarning )
2194
2200
2195
2201
def _to_new_data (labor : Dict [str , Any ]) -> Dict [str , Any ]:
2196
2202
labor ["availability" ] = self ._get_plan_worktime_hour_from_labor (labor )
@@ -2204,7 +2210,7 @@ def _to_new_data(labor: Dict[str, Any]) -> Dict[str, Any]:
2204
2210
"to" : to_date ,
2205
2211
}
2206
2212
labor_list , _ = self .api .get_labor_control (query_params )
2207
- return [_to_new_data (e ) for e in labor_list ]
2213
+ return [_to_new_data (e ) for e in labor_list if e [ "account_id" ] is not None ]
2208
2214
2209
2215
def put_labor_control_actual_worktime (
2210
2216
self ,
0 commit comments