Skip to content

Commit 43a35bd

Browse files
committed
Fixed OperatorEnum ends
1 parent e01fddb commit 43a35bd

File tree

4 files changed

+21
-8
lines changed

4 files changed

+21
-8
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2804,7 +2804,7 @@ def list_items(
28042804
)
28052805
if include_custom_metadata:
28062806
item_custom_fields = self.controller.custom_fields.list_fields(
2807-
project=project, item_ids=[i["id"] for i in res]
2807+
project=project, item_ids=[i.id for i in res]
28082808
)
28092809
for i in res:
28102810
i["custom_metadata"] = item_custom_fields[i["id"]]

src/superannotate/lib/core/jsx_conditions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class OperatorEnum(str, Enum):
1111
LT = "$lt"
1212
CONTAINS = "$cont"
1313
STARTS = "$starts"
14-
ENDS = "ENDS"
14+
ENDS = "$ends"
1515
IN = "$in"
1616
NOTIN = "$notin"
1717

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1626,7 +1626,7 @@ def execute(self):
16261626
search_ids = self._items[i : i + self.CHUNK_SIZE] # noqa
16271627
response = self._service_provider.item_service.list(
16281628
self._project.id,
1629-
self._folder.id,
1629+
None,
16301630
Filter("id", search_ids, OperatorEnum.IN),
16311631
)
16321632
if not response.ok:

src/superannotate/lib/infrastructure/services/item_service.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import base64
2+
from typing import Optional
23

34
from lib.core.entities import BaseItemEntity
45
from lib.core.jsx_conditions import Join
@@ -25,18 +26,30 @@ def get(self, project_id: int, item_id: int):
2526
)
2627
return result
2728

28-
def list(self, project_id: int, folder_id: int, query: Query):
29+
def list(self, project_id: int, folder_id: Optional[int], query: Query):
2930
query &= Join("metadata", ["path"])
31+
entity_context = [
32+
f'"team_id":{self.client.team_id}',
33+
f'"project_id":{project_id}',
34+
]
35+
if folder_id:
36+
entity_context.append(f'"folder_id":{folder_id}')
3037
result = self.client.paginate(
3138
f"{self.URL_LIST}?{query.build_query()}",
3239
item_type=BaseItemEntity,
3340
headers={
3441
"x-sa-entity-context": base64.b64encode(
35-
f'{{"team_id":{self.client.team_id},'
36-
f'"project_id":{project_id},"folder_id":{folder_id}}}'.encode(
37-
"utf-8"
38-
)
42+
f"{{{','.join(entity_context)}}}".encode("utf-8")
3943
).decode()
4044
},
4145
)
46+
# headers={
47+
# "x-sa-entity-context": base64.b64encode(
48+
# f'{{"team_id":{self.client.team_id},' +
49+
# f'"project_id":{project_id},"folder_id":{folder_id}}}'.encode(
50+
# "utf-8"
51+
# )
52+
# ).decode()
53+
# },
54+
# )
4255
return result

0 commit comments

Comments
 (0)