Skip to content

Commit cd16ff5

Browse files
committed
format
1 parent b85de4f commit cd16ff5

File tree

3 files changed

+65
-8
lines changed

3 files changed

+65
-8
lines changed

annofabapi/dataclass/organization.py

+10
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@ class OrganizationActivity:
3333
""""""
3434

3535

36+
@dataclass_json
37+
@dataclass
38+
class OrganizationSummary:
39+
"""
40+
41+
"""
42+
last_tasks_updated_datetime: Optional[str]
43+
""""""
44+
45+
3646
@dataclass_json
3747
@dataclass
3848
class Organization:

generate/generate.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ cat partial-header/dataclass/common.py partial-header/dataclass/my.py \
183183
${model_files[@]} > ../annofabapi/dataclass/my.py
184184

185185
# Organization
186-
declare -a model_files=(${MODELS_DIR}/organization_activity.py ${MODELS_DIR}/organization.py)
186+
declare -a model_files=(${MODELS_DIR}/organization_activity.py ${MODELS_DIR}/organization_summary.py ${MODELS_DIR}/organization.py)
187187
cat partial-header/dataclass/common.py partial-header/dataclass/organization.py \
188188
${model_files[@]} > ../annofabapi/dataclass/organization.py
189189

tests/test_local_utils.py

+54-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# assert to_iso8601_extension(d, tz_jst) == "2019-10-08T16:20:08.241+09:00"
66

77
from annofabapi.models import TaskPhase
8-
from annofabapi.utils import (number_of_rejections, get_task_history_index_skipped_acceptance,
8+
from annofabapi.utils import (get_number_of_rejections, get_task_history_index_skipped_acceptance,
99
get_task_history_index_skipped_inspection)
1010

1111

@@ -239,18 +239,18 @@ def test_get_task_history_index_skipped_inspection_検査2回_検査1回目で
239239
expected = []
240240
assert all([a == b for a, b in zip(actual, expected)])
241241

242-
def test_number_of_rejections_教師付1回目(self):
242+
def test_get_number_of_rejections_教師付1回目(self):
243243
task_history_short_list = [{
244244
"account_id": self.ACCOUNT_ID,
245245
"phase": "annotation",
246246
"phase_stage": 1,
247247
"worked": True
248248
}]
249249

250-
actual = number_of_rejections(task_history_short_list, TaskPhase.ACCEPTANCE)
250+
actual = get_number_of_rejections(task_history_short_list, TaskPhase.ACCEPTANCE)
251251
assert actual == 0
252252

253-
def test_number_of_rejections_受入で1回差戻(self):
253+
def test_get_number_of_rejections_受入で1回差戻(self):
254254
task_history_short_list = [
255255
{
256256
"account_id": self.ACCOUNT_ID,
@@ -272,10 +272,10 @@ def test_number_of_rejections_受入で1回差戻(self):
272272
},
273273
]
274274

275-
actual = number_of_rejections(task_history_short_list, TaskPhase.ACCEPTANCE)
275+
actual = get_number_of_rejections(task_history_short_list, TaskPhase.ACCEPTANCE)
276276
assert actual == 1
277277

278-
def test_number_of_rejections_検査で1回差戻(self):
278+
def test_get_number_of_rejections_検査で1回差戻(self):
279279
task_history_short_list = [
280280
{
281281
"account_id": self.ACCOUNT_ID,
@@ -297,5 +297,52 @@ def test_number_of_rejections_検査で1回差戻(self):
297297
},
298298
]
299299

300-
actual = number_of_rejections(task_history_short_list, TaskPhase.INSPECTION)
300+
actual = get_number_of_rejections(task_history_short_list, TaskPhase.INSPECTION)
301301
assert actual == 1
302+
303+
def test_get_number_of_rejections_検査と受入で1回差戻(self):
304+
task_history_short_list = [{
305+
"account_id": self.ACCOUNT_ID,
306+
"phase": "annotation",
307+
"phase_stage": 1,
308+
"worked": True
309+
}, {
310+
"account_id": self.ACCOUNT_ID,
311+
"phase": "inspection",
312+
"phase_stage": 1,
313+
"worked": True
314+
}, {
315+
"account_id": self.ACCOUNT_ID,
316+
"phase": "annotation",
317+
"phase_stage": 1,
318+
"worked": True
319+
}, {
320+
"account_id": self.ACCOUNT_ID,
321+
"phase": "inspection",
322+
"phase_stage": 1,
323+
"worked": True
324+
}, {
325+
"account_id": self.ACCOUNT_ID,
326+
"phase": "acceptance",
327+
"phase_stage": 1,
328+
"worked": True
329+
}, {
330+
"account_id": self.ACCOUNT_ID,
331+
"phase": "annotation",
332+
"phase_stage": 1,
333+
"worked": True
334+
}, {
335+
"account_id": "00589ed0-dd63-40db-abb2-dfe5e13c8299",
336+
"phase": "inspection",
337+
"phase_stage": 1,
338+
"worked": True
339+
}, {
340+
"account_id": self.ACCOUNT_ID,
341+
"phase": "acceptance",
342+
"phase_stage": 1,
343+
"worked": True
344+
}]
345+
actual_inspection = get_number_of_rejections(task_history_short_list, TaskPhase.INSPECTION)
346+
assert actual_inspection == 1
347+
actual_acceptance = get_number_of_rejections(task_history_short_list, TaskPhase.ACCEPTANCE)
348+
assert actual_acceptance == 1

0 commit comments

Comments
 (0)