Skip to content

Commit

Permalink
fix(product): extend fake search with default value
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanMaidurov committed Aug 8, 2024
1 parent d6660ab commit 809acb3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions product/infrastructure/fake/searchservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ func mapSortOptions(sortConfigs []sortConfig, filters []searchDomain.Filter) []s
for _, filter := range filters {
if sortFiler, ok := filter.(*searchDomain.SortFilter); ok {
lookup[sortFiler.Field()] = true // direction always true for that filter name
break
}
}

Expand All @@ -220,6 +221,11 @@ func mapSortOptions(sortConfigs []sortConfig, filters []searchDomain.Filter) []s
}
}

// if no filters come, we should decide on default, so let it be first in config
if len(lookup) == 0 && len(result) > 0 {
result[0].SelectedDesc = true
}

return result
}

Expand Down

0 comments on commit 809acb3

Please sign in to comment.