Skip to content

Commit

Permalink
Merge pull request #146 from yashsinghcodes/quick-fixes-when-pr
Browse files Browse the repository at this point in the history
[fix]: returning the same apps for the user
  • Loading branch information
frikky authored Feb 6, 2025
2 parents 384acea + 520a7fb commit a40f632
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 @@ -6971,6 +6971,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 @@ -7001,8 +7002,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 a40f632

Please sign in to comment.