From 520a7fba70b4d83a773b9bc1c805418902b4d0e8 Mon Sep 17 00:00:00 2001 From: yashsinghcodes Date: Tue, 4 Feb 2025 19:59:44 +0530 Subject: [PATCH] [fix]: returing the same apps for the user --- db-connector.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/db-connector.go b/db-connector.go index f12701c..15878e9 100755 --- a/db-connector.go +++ b/db-connector.go @@ -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 { @@ -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 {