File tree Expand file tree Collapse file tree 2 files changed +24
-8
lines changed
src/superannotate/lib/core/usecases Expand file tree Collapse file tree 2 files changed +24
-8
lines changed Original file line number Diff line number Diff line change @@ -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 ()
Original file line number Diff line number Diff line change @@ -444,6 +444,19 @@ def test_folder_export(self):
444444 )
445445 self .assertEqual (len (list ((temp_dir ).glob ("*.*" ))), 4 )
446446
447+ def test_project_completed_count (self ):
448+ sa .upload_images_from_folder_to_project (
449+ self .PROJECT_NAME , self .folder_path , annotation_status = "Completed"
450+ )
451+ sa .create_folder (self .PROJECT_NAME , self .TEST_FOLDER_NAME_1 )
452+ project = f"{ self .PROJECT_NAME } /{ self .TEST_FOLDER_NAME_1 } "
453+ sa .upload_images_from_folder_to_project (
454+ project , self .folder_path , annotation_status = "Completed"
455+ )
456+ project_metadata = sa .get_project_metadata (self .PROJECT_NAME , include_complete_image_count = True )
457+ self .assertEqual (project_metadata ['completed_images_count' ], 8 )
458+ self .assertEqual (project_metadata ['rootFolderCompletedImagesCount' ], 4 )
459+
447460 def test_folder_image_annotation_status (self ):
448461 sa .upload_images_from_folder_to_project (
449462 self .PROJECT_NAME , self .folder_path , annotation_status = "InProgress"
You can’t perform that action at this time.
0 commit comments