Skip to content

Commit 91d0560

Browse files
committed
Merge branch 'friday' into 1209_fix_folder_metadata
2 parents 713e235 + 8dad9b9 commit 91d0560

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2827,7 +2827,7 @@ def upload_custom_values(
28272827
The values for the corresponding keys will be added to an item or will be overridden.
28282828
:type items: list of dicts
28292829
2830-
:return: the count of succeeded items and the list of failed item names.
2830+
:return: dictionary with succeeded and failed item names.
28312831
:rtype: dict
28322832
28332833
Request Example:

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,23 @@ def __init__(
7878
self._backend_client = backend_client
7979

8080
def execute(self) -> Response:
81+
if self._fields:
82+
self.reporter.log_info("Matched fields deleted from schema.")
8183
response = self._backend_client.delete_custom_schema(
8284
team_id=self._project.team_id,
8385
project_id=self._project.id,
8486
fields=self._fields,
8587
)
8688
if response.ok:
87-
self._response.data = response.data
89+
use_case_response = GetCustomSchemaUseCase(
90+
reporter=self.reporter,
91+
project=self._project,
92+
backend_client=self._backend_client,
93+
).execute()
94+
if use_case_response.errors:
95+
self._response.errors = use_case_response.errors
96+
else:
97+
self._response.data = use_case_response.data
8898
else:
8999
self._response.errors = response.error
90100
return self._response
@@ -132,7 +142,7 @@ def execute(self) -> Response:
132142
the schema of the custom fields defined for the "{self._project.name}" project."""
133143
)
134144
self._response.data = {
135-
"succeeded": {list(item)[0] for item in self._items} ^ set(failed_items),
145+
"succeeded": list({list(item)[0] for item in self._items} ^ set(failed_items)),
136146
"failed": failed_items,
137147
}
138148
return self._response

src/superannotate/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "4.4.1dev4"
1+
__version__ = "4.4.1dev6"

tests/integration/custom_fields/test_custom_schema.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,18 @@ def test_delete_schema(self):
4646
payload = copy.copy(self.PAYLOAD)
4747
sa.create_custom_fields(self.PROJECT_NAME, payload)
4848
to_delete_field = list(payload.keys())[0]
49-
sa.delete_custom_fields(self.PROJECT_NAME, [to_delete_field])
49+
response = sa.delete_custom_fields(self.PROJECT_NAME, [to_delete_field])
5050
del payload[to_delete_field]
51+
assert response == payload
5152
self.assertEqual(sa.get_custom_fields(self.PROJECT_NAME), payload)
5253

5354
def test_upload_delete_custom_values(self):
5455
sa.create_custom_fields(self.PROJECT_NAME, self.PAYLOAD)
5556
item_name = "test"
5657
payload = {"test": 12}
5758
sa.attach_items(self.PROJECT_NAME, [{"name": item_name, "url": item_name}])
58-
sa.upload_custom_values(self.PROJECT_NAME, [{item_name: payload}] * 10000)
59+
response = sa.upload_custom_values(self.PROJECT_NAME, [{item_name: payload}] * 10000)
60+
assert response == {'failed': [], 'succeeded': {item_name}}
5961
data = sa.query(self.PROJECT_NAME, "metadata(status = NotStarted)")
6062
assert data[0]["custom_metadata"] == payload
6163
sa.delete_custom_values(self.PROJECT_NAME, [{item_name: ["test"]}])

0 commit comments

Comments
 (0)