@@ -125,15 +125,18 @@ def execute(self):
125125 )
126126 data ["project" ] = project
127127 if self ._include_complete_image_count :
128- projects = self ._projects .get_all (
129- condition = (
130- Condition ("completeImagesCount" , "true" , EQ )
131- & Condition ("name" , self ._project .name , EQ )
132- & Condition ("team_id" , self ._project .team_id , EQ )
133- )
128+ completed_images_data = self ._service .bulk_get_folders (
129+ self ._project .team_id , [project .uuid ]
134130 )
135- if projects :
136- data ["project" ] = projects [0 ]
131+ root_completed_count = 0
132+ total_completed_count = 0
133+ for i in completed_images_data ['data' ]:
134+ total_completed_count += i ['completedCount' ]
135+ if i ['is_root' ]:
136+ root_completed_count = i ['completedCount' ]
137+
138+ project .root_folder_completed_images_count = root_completed_count
139+ project .completed_images_count = total_completed_count
137140
138141 if self ._include_annotation_classes :
139142 self .annotation_classes_use_case .execute ()
@@ -168,7 +171,6 @@ def __init__(
168171 settings : List [ProjectSettingEntity ] = None ,
169172 workflows : List [WorkflowEntity ] = None ,
170173 annotation_classes : List [AnnotationClassEntity ] = None ,
171- contributors : Iterable [dict ] = None ,
172174 ):
173175
174176 super ().__init__ ()
@@ -180,7 +182,6 @@ def __init__(
180182 self ._workflows_repo = workflows_repo
181183 self ._workflows = workflows
182184 self ._annotation_classes = annotation_classes
183- self ._contributors = contributors
184185 self ._backend_service = backend_service_provider
185186
186187 def validate_project_name (self ):
@@ -258,22 +259,6 @@ def execute(self):
258259 self ._response .errors = set_workflow_response .errors
259260 data ["workflows" ] = self ._workflows
260261
261- if self ._contributors :
262- for contributor in self ._contributors :
263- self ._backend_service .share_project_bulk (
264- team_id = entity .team_id ,
265- project_id = entity .uuid ,
266- users = [
267- {
268- "user_id" : contributor ["user_id" ],
269- "user_role" : constances .UserRole .get_value (
270- contributor ["user_role" ]
271- ),
272- }
273- ],
274- )
275- data ["contributors" ] = self ._contributors
276-
277262 logger .info (
278263 "Created project %s (ID %s) with type %s" ,
279264 self ._response .data .name ,
@@ -701,8 +686,9 @@ def execute(self):
701686 if self ._fill_classes :
702687 annotation_classes = self ._annotation_classes .get_all ()
703688 for annotation_class in annotation_classes :
704- annotation_class .uuid = workflow .class_id
705- workflow_data ["className" ] = annotation_class .name
689+ if annotation_class .id == workflow .class_id :
690+ workflow_data ["className" ] = annotation_class .name
691+ break
706692 data .append (workflow_data )
707693 self ._response .data = data
708694 return self ._response
0 commit comments