Skip to content

Commit 6ed60ea

Browse files
Vaghinak BasentsyanVaghinak Basentsyan
authored andcommitted
Changed limitations texts
1 parent 746a114 commit 6ed60ea

File tree

3 files changed

+29
-35
lines changed

3 files changed

+29
-35
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import concurrent.futures
21
import io
32
import json
43
import logging

src/superannotate/lib/core/__init__.py

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -76,30 +76,20 @@
7676

7777
UPLOAD_FOLDER_LIMIT_ERROR_MESSAGE = "The number of items you want to upload exceeds the limit of 50 000 items per folder."
7878
UPLOAD_PROJECT_LIMIT_ERROR_MESSAGE = "The number of items you want to upload exceeds the limit of 500 000 items per project."
79-
UPLOAD_USER_LIMIT_ERROR_MESSAGE = "The number of items you want to upload exceeds the limit of your subscription plan."
79+
UPLOAD_USER_LIMIT_ERROR_MESSAGE = "The number of items you want to upload exceeds the limit of your subscription plan."
8080

8181
ATTACH_FOLDER_LIMIT_ERROR_MESSAGE = "The number of items you want to attach exceeds the limit of 50 000 items per folder."
8282
ATTACH_PROJECT_LIMIT_ERROR_MESSAGE = "The number of items you want to attach exceeds the limit of 500 000 items per project."
8383
ATTACH_USER_LIMIT_ERROR_MESSAGE = "The number of items you want to attach exceeds the limit of your subscription plan."
8484

85-
COPY_ITEMS_LIMIT_ERROR_MESSAGE = (
86-
"The number of items you want to copy exceeds the limit of 50 000 items per folder."
87-
)
88-
COPY_ITEM_PROJECT_LIMIT_ERROR_MESSAGE = (
89-
"The copy exceeds the limit of 50 0000 items per project."
90-
)
91-
MOVE_ITEMS_LIMIT_ERROR_MESSAGE = (
92-
"The number of items you want to move exceeds the limit of 50 000 items per folder."
93-
)
94-
MOVE_ITEM_PROJECT_LIMIT_ERROR_MESSAGE = (
95-
"The number of items you want to move exceeds the limit of 50 000 items per folder."
96-
)
9785

98-
COPY_FOLDER_LIMIT_ERROR_MESSAGE = (
99-
"The number of items you want to copy exceeds the limit of 50 000 items per folder."
100-
)
86+
COPY_FOLDER_LIMIT_ERROR_MESSAGE = "The number of items you want to copy exceeds the limit of 50 000 items per folder."
87+
COPY_PROJECT_LIMIT_ERROR_MESSAGE = "The number of items you want to copy exceeds the limit of 500 000 items per project."
88+
COPY_SUPER_LIMIT_ERROR_MESSAGE = "The number of items you want to copy exceeds the limit of your subscription plan."
89+
10190

102-
__version__ = "?"
91+
MOVE_FOLDER_LIMIT_ERROR_MESSAGE = "The number of items you want to move exceeds the limit of 50 000 items per folder."
92+
MOVE_PROJECT_LIMIT_ERROR_MESSAGE = "The number of items you want to move exceeds the limit of 500 000 items per project."
10393

10494
__alL__ = (
10595
ProjectType,

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

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,9 @@ def _validate_limitations(self, images_to_copy_count):
595595
if not response.ok:
596596
raise AppValidationException(response.error)
597597
if images_to_copy_count > response.data.folder_limit.remaining_image_count:
598-
AppValidationException(constances.COPY_ITEMS_LIMIT_ERROR_MESSAGE)
598+
AppValidationException(constances.COPY_FOLDER_LIMIT_ERROR_MESSAGE)
599+
if images_to_copy_count > response.data.project_limit.remaining_image_count:
600+
AppValidationException(constances.COPY_PROJECT_LIMIT_ERROR_MESSAGE)
599601

600602
def validate_project_type(self):
601603
if self._project.project_type in constances.LIMITED_FUNCTIONS:
@@ -735,7 +737,9 @@ def validate_limitations(self):
735737
if not response.ok:
736738
raise AppValidationException(response.error)
737739
if to_upload_count > response.data.folder_limit.remaining_image_count:
738-
raise AppValidationException(constances.MOVE_ITEMS_LIMIT_ERROR_MESSAGE)
740+
raise AppValidationException(constances.MOVE_FOLDER_LIMIT_ERROR_MESSAGE)
741+
if to_upload_count > response.data.project_limit.remaining_image_count:
742+
raise AppValidationException(constances.MOVE_PROJECT_LIMIT_ERROR_MESSAGE)
739743

740744
def execute(self):
741745
if self.is_valid():
@@ -1982,21 +1986,22 @@ def validate_limitations(self):
19821986
)
19831987
if not response.ok:
19841988
raise AppValidationException(response.error)
1985-
if response.data.folder_limit.remaining_image_count < 1:
1986-
if self._move:
1987-
raise AppValidationException(constances.MOVE_ITEMS_LIMIT_ERROR_MESSAGE)
1988-
raise AppValidationException(constances.COPY_ITEMS_LIMIT_ERROR_MESSAGE)
1989-
elif (
1990-
self._to_project.uuid != self._from_project.uuid
1991-
and response.data.project_limit.remaining_image_count < 1
1992-
):
1993-
if self._move:
1994-
raise AppValidationException(
1995-
constances.MOVE_ITEM_PROJECT_LIMIT_ERROR_MESSAGE
1996-
)
1997-
raise AppValidationException(
1998-
constances.COPY_ITEM_PROJECT_LIMIT_ERROR_MESSAGE
1999-
)
1989+
1990+
if self._move:
1991+
if self._from_project.uuid == self._to_project.uuid:
1992+
if self._from_folder.uuid == self._to_folder.uuid:
1993+
raise AppValidationException("Cannot move image if source_project == destination_project.")
1994+
elif response.data.folder_limit.remaining_image_count < 1:
1995+
raise AppValidationException(constances.MOVE_FOLDER_LIMIT_ERROR_MESSAGE)
1996+
elif response.data.project_limit.remaining_image_count < 1:
1997+
raise AppValidationException(constances.MOVE_PROJECT_LIMIT_ERROR_MESSAGE)
1998+
else:
1999+
if response.data.folder_limit.remaining_image_count < 1:
2000+
raise AppValidationException(constances.COPY_FOLDER_LIMIT_ERROR_MESSAGE)
2001+
if response.data.project_limit.remaining_image_count < 1:
2002+
raise AppValidationException(constances.COPY_PROJECT_LIMIT_ERROR_MESSAGE)
2003+
if response.data.super_user_limit and response.data.super_user_limit.remaining_image_count < 1:
2004+
raise AppValidationException(constances.COPY_SUPER_LIMIT_ERROR_MESSAGE)
20002005

20012006
def execute(self) -> Response:
20022007
if self.is_valid():

0 commit comments

Comments
 (0)