Skip to content

Fix/update status of inspections #93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion annofabapi/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.21.3'
__version__ = '0.21.4'
8 changes: 5 additions & 3 deletions annofabapi/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from annofabapi import AnnofabApi
from annofabapi.exceptions import AnnofabApiException
from annofabapi.models import (AnnotationSpecs, InputData, Inspection, Instruction, JobInfo, JobType, MyOrganization,
OrganizationMember, Project, ProjectMember, SupplementaryData, Task)
OrganizationMember, Project, ProjectMember, SupplementaryData, Task, InspectionStatus)

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -348,7 +348,7 @@ def put_supplementary_data_from_file(self, project_id, input_data_id: str, suppl
#########################################
def update_status_of_inspections(self, project_id: str, task_id: str, input_data_id: str,
filter_inspection: Callable[[Inspection], bool],
inspection_status: str) -> List[Inspection]:
inspection_status: InspectionStatus) -> List[Inspection]:
"""
検査コメント(返信コメント以外)のstatusを変更する。

Expand All @@ -375,9 +375,11 @@ def search_updated_inspections(arg_inspection: Inspection) -> bool:
target_inspections = [e for e in inspections if search_updated_inspections(e)]

for inspection in target_inspections:
inspection["status"] = inspection_status
inspection["status"] = inspection_status.value
if inspection["updated_datetime"] is None:
inspection["updated_datetime"] = inspection["created_datetime"]
else:
inspection["updated_datetime"] = annofabapi.utils.str_now()

req_inspection = [{"data": e, "_type": "Put"} for e in target_inspections]
content = self.api.batch_update_inspections(project_id, task_id, input_data_id, req_inspection)[0]
Expand Down