Skip to content

Commit

Permalink
[fix]: returing the same apps for the user
Browse files Browse the repository at this point in the history
  • Loading branch information
yashsinghcodes committed Feb 4, 2025
1 parent 942ed1d commit 520a7fb
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion db-connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -6969,6 +6969,7 @@ func GetUserApps(ctx context.Context, userId string) ([]WorkflowApp, error) {
for {
innerApp := WorkflowApp{}
_, err = it.Next(&innerApp)
alreadyExists := false
//log.Printf("Got app: %s (%s)", innerApp.Name, innerApp.ID)
cnt += 1
if cnt > maxAmount {
Expand Down Expand Up @@ -6999,8 +7000,16 @@ func GetUserApps(ctx context.Context, userId string) ([]WorkflowApp, error) {
continue
}

userApps = append(userApps, innerApp)
// Not sure if it actually make the API slower
for _, app := range userApps {
if app.ID == innerApp.ID {
alreadyExists = true
}
}

if !alreadyExists {
userApps = append(userApps, innerApp)
}
}

if err != nil {
Expand Down

0 comments on commit 520a7fb

Please sign in to comment.