Skip to content

Commit 0835433

Browse files
authored
Merge pull request #655 from superannotateai/FRIDAY-2369
fix upload_annotations set_defaults
2 parents 8813e7c + ef3f8f4 commit 0835433

File tree

5 files changed

+11
-1
lines changed

5 files changed

+11
-1
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ History
77
All release highlights of this project will be documented in this file.
88

99
4.4.16 - November 12, 2023
10-
_______________________
10+
__________________________
1111

1212
**Added**
1313

src/superannotate/lib/app/interface/sdk_interface.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,6 +1668,7 @@ def upload_annotations(
16681668
folder=folder,
16691669
annotations=annotations,
16701670
keep_status=keep_status,
1671+
user=self.controller.current_user,
16711672
)
16721673
if response.errors:
16731674
raise AppException(response.errors)

src/superannotate/lib/core/usecases/annotations.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ def __init__(
295295
folder: FolderEntity,
296296
annotations: List[dict],
297297
service_provider: BaseServiceProvider,
298+
user: UserEntity,
298299
keep_status: bool = False,
299300
):
300301
super().__init__(reporter)
@@ -304,6 +305,7 @@ def __init__(
304305
self._service_provider = service_provider
305306
self._keep_status = keep_status
306307
self._report = Report([], [], [], [])
308+
self._user = user
307309

308310
def validate_project_type(self):
309311
if self._project.type == constants.ProjectType.PIXEL.value:
@@ -439,6 +441,9 @@ def execute(self):
439441
annotation_name = annotation["metadata"]["name"]
440442
item = name_item_map.get(annotation_name)
441443
if item:
444+
annotation = UploadAnnotationUseCase.set_defaults(
445+
self._user.email, annotation, self._project.type
446+
)
442447
items_to_upload.append(
443448
ItemToUpload(item=item, annotation_json=annotation)
444449
)

src/superannotate/lib/infrastructure/controller.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,7 @@ def upload_multiple(
568568
folder: FolderEntity,
569569
annotations: List[dict],
570570
keep_status: bool,
571+
user: UserEntity,
571572
):
572573
use_case = usecases.UploadAnnotationsUseCase(
573574
reporter=Reporter(),
@@ -576,6 +577,7 @@ def upload_multiple(
576577
annotations=annotations,
577578
service_provider=self.service_provider,
578579
keep_status=keep_status,
580+
user=user,
579581
)
580582
return use_case.execute()
581583

tests/integration/annotations/test_upload_annotations.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ def test_annotation_folder_upload_download(self):
7171
assert i["annotation_status"] == "InProgress"
7272
assert annotation["instances"][-1]["type"] == "tag"
7373
assert annotation["instances"][-2]["type"] == "tag"
74+
assert annotation["instances"][-2]["probability"] == 100
75+
assert annotation["instances"][-2]["creationType"] == "Preannotation"
7476

7577
def test_upload_keep_true(self):
7678
self._attach_items()

0 commit comments

Comments
 (0)