@@ -2147,7 +2147,7 @@ func (q *FakeQuerier) GetTemplateParameterInsights(ctx context.Context, arg data
2147
2147
for value ,count := range counts [key ] {
2148
2148
rows = append (rows , database.GetTemplateParameterInsightsRow {
2149
2149
Num :utp .Num ,
2150
- TemplateIDs :utp .TemplateIDs ,
2150
+ TemplateIDs :uniqueSortedUUIDs ( utp .TemplateIDs ) ,
2151
2151
Name :utp .Name ,
2152
2152
DisplayName :utp .DisplayName ,
2153
2153
Description :utp .Description ,
@@ -2161,6 +2161,21 @@ func (q *FakeQuerier) GetTemplateParameterInsights(ctx context.Context, arg data
2161
2161
return rows ,nil
2162
2162
}
2163
2163
2164
+ func uniqueSortedUUIDs (uuids []uuid.UUID ) []uuid.UUID {
2165
+ set := make (map [uuid.UUID ]struct {})
2166
+ for _ ,id := range uuids {
2167
+ set [id ]= struct {}{}
2168
+ }
2169
+ unique := make ([]uuid.UUID ,0 ,len (set ))
2170
+ for id := range set {
2171
+ unique = append (unique ,id )
2172
+ }
2173
+ slices .SortFunc (unique ,func (a ,b uuid.UUID )bool {
2174
+ return a .String ()< b .String ()
2175
+ })
2176
+ return unique
2177
+ }
2178
+
2164
2179
func (q * FakeQuerier )GetTemplateVersionByID (ctx context.Context ,templateVersionID uuid.UUID ) (database.TemplateVersion ,error ) {
2165
2180
q .mutex .RLock ()
2166
2181
defer q .mutex .RUnlock ()