Browse Source

#2701

distinct by sourceSpecId
pull/2799/head
chenyifan01 2 years ago
parent
commit
b31f565893
1 changed files with 0 additions and 6 deletions
  1. +0
    -6
      services/cloudbrain/resource/resource_specification.go

+ 0
- 6
services/cloudbrain/resource/resource_specification.go View File

@@ -208,15 +208,10 @@ func FindAvailableSpecs(userId int64, opts models.FindSpecsOptions) ([]*models.S


func filterExclusiveSpecs(r []*models.Specification, userId int64) []*models.Specification { func filterExclusiveSpecs(r []*models.Specification, userId int64) []*models.Specification {
specs := make([]*models.Specification, 0, len(r)) specs := make([]*models.Specification, 0, len(r))
specMap := make(map[int64]string, 0)
for i := 0; i < len(r); i++ { for i := 0; i < len(r); i++ {
spec := r[i] spec := r[i]
if _, has := specMap[spec.ID]; has {
continue
}
if !spec.IsExclusive { if !spec.IsExclusive {
specs = append(specs, spec) specs = append(specs, spec)
specMap[spec.ID] = ""
continue continue
} }
orgs := strings.Split(spec.ExclusiveOrg, ";") orgs := strings.Split(spec.ExclusiveOrg, ";")
@@ -224,7 +219,6 @@ func filterExclusiveSpecs(r []*models.Specification, userId int64) []*models.Spe
isMember, _ := models.IsOrganizationMemberByOrgName(org, userId) isMember, _ := models.IsOrganizationMemberByOrgName(org, userId)
if isMember { if isMember {
specs = append(specs, spec) specs = append(specs, spec)
specMap[spec.ID] = ""
} }
} }
} }


Loading…
Cancel
Save