Skip to content

Commit 5ed4313

Browse files
committed
Drop project.users field
1 parent 767e283 commit 5ed4313

File tree

5 files changed

+16
-33
lines changed

5 files changed

+16
-33
lines changed

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

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,7 @@ def clone_project(
13341334
self.controller.projects.add_contributors(
13351335
self.controller.team, new_project, project.contributors
13361336
)
1337-
new_project.users = project.contributors
1337+
new_project.contributors = project.contributors
13381338
if copy_annotation_classes:
13391339
logger.info(
13401340
f"Cloning annotation classes from {from_project} to {project_name}."
@@ -1354,15 +1354,12 @@ def clone_project(
13541354

13551355
if response.errors:
13561356
raise AppException(response.errors)
1357-
data = ProjectSerializer(response.data).serialize()
1358-
if data.get("users"):
1359-
for contributor in data["users"]:
1360-
contributor[
1361-
"user_role"
1362-
] = self.controller.service_provider.get_role_name(
1363-
new_project, contributor["user_role"]
1364-
)
1365-
return data
1357+
project = ProjectSerializer(response.data).serialize()
1358+
for contributor in project["contributors"]:
1359+
contributor["role"] = self.controller.service_provider.get_role_name(
1360+
project, contributor["role"]
1361+
)
1362+
return project
13661363

13671364
def create_categories(
13681365
self, project: Union[NotEmptyStr, int], categories: List[NotEmptyStr]
@@ -1753,7 +1750,6 @@ def get_project_metadata(
17531750
"raw_config": {"roles": ["Annotator", "QA"], ...}
17541751
},
17551752
"upload_state": "INITIAL",
1756-
"users": [],
17571753
"contributors": [],
17581754
"settings": [],
17591755
"classes": [],
@@ -1782,15 +1778,12 @@ def get_project_metadata(
17821778
)
17831779
if response.errors:
17841780
raise AppException(response.errors)
1785-
data = ProjectSerializer(response.data).serialize()
1786-
if data.get("users"):
1787-
for contributor in data["users"]:
1788-
contributor[
1789-
"user_role"
1790-
] = self.controller.service_provider.get_role_name(
1791-
response.data, contributor["user_role"]
1792-
)
1793-
return data
1781+
project = ProjectSerializer(response.data).serialize()
1782+
for contributor in project["contributors"]:
1783+
contributor["role"] = self.controller.service_provider.get_role_name(
1784+
project, contributor["role"]
1785+
)
1786+
return project
17941787

17951788
def get_project_settings(self, project: Union[NotEmptyStr, dict]):
17961789
"""Gets project's settings.

src/superannotate/lib/core/entities/project.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ class ProjectEntity(TimedBaseModel):
109109
workflow: Optional[WorkflowEntity]
110110
sync_status: Optional[int]
111111
upload_state: Optional[int]
112-
users: Optional[List[WMProjectUserEntity]] = []
113112
contributors: List[WMProjectUserEntity] = []
114113
settings: List[SettingEntity] = []
115114
classes: List[AnnotationClassEntity] = []
@@ -138,7 +137,7 @@ def __copy__(self):
138137
instructions_link=self.instructions_link,
139138
status=self.status,
140139
folder_id=self.folder_id,
141-
users=self.users,
140+
contributors=self.contributors,
142141
settings=[s.__copy__() for s in self.settings],
143142
upload_state=self.upload_state,
144143
workflow_id=self.workflow_id,

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,7 @@ def execute(self):
175175
project_id=project.id,
176176
parent_entity=CustomFieldEntityEnum.PROJECT,
177177
).data
178-
else:
179-
project.users = []
178+
180179
if self._include_custom_fields:
181180
context = {"team_id": self._project.team_id}
182181
custom_fields_names = self._service_provider.list_custom_field_names(

tests/integration/projects/test_clone_project.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,3 @@ def test_clone_video_project_frame_mode_off(self):
234234
for s in new_settings:
235235
if s["attribute"] == "FrameMode":
236236
assert not s["value"]
237-
238-
239-
#
240-
#
241-
# def test_():
242-
# sa.delete_project("tod")
243-
# sa.get_project_metadata('tttp', include_contributors=True)
244-
# sa.clone_project('tod', 'tttp', copy_contributors=True)

tests/integration/work_management/test_list_users.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def test_pending_users(self):
2929
sa.invite_contributors_to_team(emails=[test_email])
3030
sa.add_contributors_to_project(self.PROJECT_NAME, [test_email], "Annotator")
3131
project = sa.get_project_metadata(self.PROJECT_NAME, include_contributors=True)
32-
assert project['contributors'][1]["state"] == "Pending"
32+
assert project["contributors"][1]["state"] == "Pending"
3333

3434
def test_list_users_by_project_name(self):
3535
project_users = sa.list_users(project=self.PROJECT_NAME)

0 commit comments

Comments
 (0)