🐛 Fix bad check on leave nitrate org

This commit is contained in:
Pablo Alba 2026-04-17 11:36:39 +02:00 committed by Pablo Alba
parent 42ebee88d6
commit b2c9e08d42

View File

@ -133,17 +133,6 @@
valid-teams-to-leave-ids (into valid-teams-to-transfer-ids valid-teams-to-exit-ids) valid-teams-to-leave-ids (into valid-teams-to-transfer-ids valid-teams-to-exit-ids)
;; Get all the teams ids
all-teams-ids (into #{} d/xf:map-id (:teams org-summary))
;; Get all the ids of the teams that will be processed:
;; all the ids on teams-to-leave, teams-to-delete and default-team-id
selected-team-ids (-> (into #{default-team-id} teams-to-delete)
(into d/xf:map-id teams-to-leave))
;; Check that we are processing all the teams
all-teams-selected? (= all-teams-ids selected-team-ids)
default-team-files-count (-> (db/exec-one! conn [sql:get-team-files-count default-team-id]) default-team-files-count (-> (db/exec-one! conn [sql:get-team-files-count default-team-id])
:total) :total)
delete-default-team? (= default-team-files-count 0) delete-default-team? (= default-team-files-count 0)
@ -171,8 +160,7 @@
(when (or (when (or
(not valid-teams-to-delete?) (not valid-teams-to-delete?)
(not valid-teams-to-leave?) (not valid-teams-to-leave?)
(not valid-default-team-id?) (not valid-default-team-id?))
(not all-teams-selected?))
(ex/raise :type :validation (ex/raise :type :validation
:code :not-valid-teams)) :code :not-valid-teams))