Skip to content

Commit ecfae66

Browse files
committed
Fix clone_project
1 parent bca3851 commit ecfae66

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -858,20 +858,24 @@ def execute(self):
858858
for contributor in self._contributors:
859859
role_email_map[contributor.role].append(contributor.email)
860860
user_to_retrieve.append(contributor.email)
861-
861+
_filter = Filter(
862+
"role", constants.UserRole.CONTRIBUTOR.value, OperatorEnum.EQ
863+
)
864+
if user_to_retrieve:
865+
_filter &= (Filter("email", user_to_retrieve, OperatorEnum.IN),)
862866
users = self._service_provider.work_management.list_users(
863-
Filter("role", constants.UserRole.CONTRIBUTOR.value, OperatorEnum.EQ)
864-
& Filter("email", user_to_retrieve, OperatorEnum.IN),
867+
_filter,
865868
parent_entity=CustomFieldEntityEnum.TEAM,
866869
).data
867870
for user in users:
868871
team_users.add(user.email)
869872

870873
to_skip = []
871874
to_add = []
872-
873875
project_users = self._service_provider.work_management.list_users(
874-
Filter("email", user_to_retrieve, OperatorEnum.IN),
876+
Filter("email", user_to_retrieve, OperatorEnum.IN)
877+
if user_to_retrieve
878+
else EmptyQuery(),
875879
include_custom_fields=True,
876880
parent_entity=CustomFieldEntityEnum.PROJECT,
877881
project_id=self._project.id,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,8 @@ def delete_custom_field_template(
400400
method="delete",
401401
url=self.URL_CUSTOM_FIELD_TEMPLATE_DELETE.format(template_id=pk),
402402
params={
403-
"entity": entity,
404-
"parentEntity": parent_entity,
403+
"entity": entity.value,
404+
"parentEntity": parent_entity.value,
405405
},
406406
headers={
407407
"x-sa-entity-context": self._generate_context(

tests/integration/mixpanel/test_mixpanel_decorator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
class TestMixpanel(TestCase):
1919
BLANK_PAYLOAD = {
20+
"Env": "N/A",
2021
"SDK": True,
2122
"Team": sa.get_team_metadata()["name"],
2223
"User Email": sa.controller.current_user.email,

0 commit comments

Comments
 (0)