fix: project add validation (#997)

* fix: add project validation

* fix: removed loop
This commit is contained in:
Silvan 2020-11-21 17:20:01 +01:00 committed by GitHub
parent 5d2c053f87
commit 855725c3c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -514,8 +514,8 @@ func addProjectValidation(projectName string) func(...*es_models.Event) error {
_, project := model.GetProject(projects, event.AggregateID)
project.AppendAddProjectEvent(event)
case model.ProjectRemoved:
for i, project := range projects {
if project.AggregateID == event.AggregateID {
for i := len(projects) - 1; i >= 0; i-- {
if projects[i].AggregateID == event.AggregateID {
projects[i] = projects[len(projects)-1]
projects[len(projects)-1] = nil
projects = projects[:len(projects)-1]