Skip to content

Commit

Permalink
Merge pull request #944 from gobitfly/BEDS-591/nulls_in_getMostNotifi…
Browse files Browse the repository at this point in the history
…edGroups

fix(notifications): handle null in group name column
  • Loading branch information
peterbitfly authored Oct 11, 2024
2 parents 801fea3 + e51c1cb commit eaede6a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/pkg/api/data_access/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (d *DataAccessService) GetNotificationOverview(ctx context.Context, userId

// join result with names
query = goqu.Dialect("postgres").
Select("name").
Select(goqu.L("COALESCE(name, 'default') AS name")).
From(query.As("history")).
LeftJoin(goqu.I(groupsTable).As("groups"), goqu.On(
goqu.Ex{"groups.dashboard_id": goqu.I("history.dashboard_id")},
Expand All @@ -158,12 +158,12 @@ func (d *DataAccessService) GetNotificationOverview(ctx context.Context, userId
mostNotifiedGroups := [3]string{}
querySql, args, err := query.Prepared(true).ToSQL()
if err != nil {
return mostNotifiedGroups, err
return mostNotifiedGroups, fmt.Errorf("failed to prepare getMostNotifiedGroups query: %w", err)
}
res := []string{}
err = d.alloyReader.SelectContext(ctx, &res, querySql, args...)
if err != nil {
return mostNotifiedGroups, err
return mostNotifiedGroups, fmt.Errorf("failed to execute getMostNotifiedGroups query: %w", err)
}
copy(mostNotifiedGroups[:], res)
return mostNotifiedGroups, err
Expand Down

0 comments on commit eaede6a

Please sign in to comment.