Skip to content

Commit

Permalink
bugfix for both filter and search in expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardLindhout committed Oct 8, 2021
1 parent fcd1ba2 commit caddabd
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions template_files/generated_filter.gotpl
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,21 @@ func IntFilterToMods(m *{{ $.Frontend.PackageName }}.IntFilter, column string) [
return nil
}
if m.Search != nil || m.Where != nil {
var queryMods []qm.QueryMod
queryMods = append(queryMods, {{ .BoilerModel.Name }}SearchToMods(m.Search)...)
queryMods = append(queryMods, {{ .BoilerModel.Name }}WhereToMods(m.Where, true, "", "")...)
if len(queryMods) > 0 {

searchMods := {{ .BoilerModel.Name }}SearchToMods(m.Search)
filterMods := {{ .BoilerModel.Name }}WhereToMods(m.Where, true, "", "")
if len(searchMods) > 0 && len(filterMods) > 0 {
return []qm.QueryMod{
qm.Expr(searchMods...),
qm.Expr(filterMods...),
}
} else if len(searchMods) > 0 {
return []qm.QueryMod{
qm.Expr(searchMods...),
}
} else if len(filterMods) > 0 {
return []qm.QueryMod{
qm.Expr(queryMods...),
qm.Expr(filterMods...),
}
}
}
Expand Down

0 comments on commit caddabd

Please sign in to comment.