Skip to content

Commit

Permalink
Update composite key
Browse files Browse the repository at this point in the history
Signed-off-by: abdullah1308 <abdullahrafi.1308@gmail.com>
  • Loading branch information
abdullah1308 committed Jul 11, 2023
1 parent 5299ea5 commit b911314
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion models/meshmodel/core/v1alpha1/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func GetMeshModelComponents(db *database.Handler, f ComponentFilter) (c []Compon
countUniqueComponents := func(components []componentDefinitionWithModel) int {
set := make(map[string]struct{})
for _, model := range components {
key := model.ComponentDefinitionDB.Kind + "@" + model.ModelDB.Name
key := model.ComponentDefinitionDB.Kind + "@" + model.APIVersion + "@" + model.ModelDB.Name + "@" + model.ModelDB.Version
if _, ok := set[key]; !ok {
set[key] = struct{}{}
}
Expand Down
5 changes: 3 additions & 2 deletions models/meshmodel/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,9 @@ func (rm *RegistryManager) GetModels(db *database.Handler, f types.Filter) ([]v1
countUniqueModels := func(models []modelWithCategories) int {
set := make(map[string]struct{})
for _, model := range models {
if _, ok := set[model.ModelDB.Name]; !ok {
set[model.ModelDB.Name] = struct{}{}
key := model.ModelDB.Name + "@" + model.ModelDB.Version
if _, ok := set[key]; !ok {
set[key] = struct{}{}
}
}
return len(set)
Expand Down

0 comments on commit b911314

Please sign in to comment.