Skip to content

Commit

Permalink
Fix project destroy_service to update samples_count properly
Browse files Browse the repository at this point in the history
  • Loading branch information
malchua committed Oct 3, 2024
1 parent e6a9661 commit 59cde47
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/services/projects/destroy_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ class DestroyService < BaseProjectService
def execute # rubocop:disable Metrics/AbcSize
authorize! project, to: :destroy?

deleted_samples_count = @project.samples.size

project.namespace.destroy!

create_activities if project.namespace.deleted?

return unless project.namespace.deleted? && project.namespace.type != Namespaces::UserNamespace.sti_name

update_samples_count if @project.parent.type == 'Group'
update_samples_count(deleted_samples_count) if @project.parent.type == 'Group'

project.namespace.update_metadata_summary_by_namespace_deletion
end
Expand All @@ -31,8 +33,7 @@ def create_activities
}
end

def update_samples_count
deleted_samples_count = @project.samples.size
def update_samples_count(deleted_samples_count)
@project.parent.update_samples_count_by_destroy_service(deleted_samples_count)
end
end
Expand Down

0 comments on commit 59cde47

Please sign in to comment.