Merge recent UI & Postgres work into main branch #4
1 changed files with 4 additions and 6 deletions
|
|
@ -45,11 +45,9 @@ func PeopleSearch(params PeopleSearchParams) (PeopleSearchResults, error) {
|
|||
|
||||
// SQL qeury for results
|
||||
sqlQuery := `
|
||||
SELECT people.*,
|
||||
sections.name AS Section__name
|
||||
SELECT people.*
|
||||
FROM people
|
||||
INNER JOIN sections
|
||||
ON people.section_id = sections.id`
|
||||
`
|
||||
|
||||
// SQL query to count results
|
||||
sqlQueryCount := `
|
||||
|
|
@ -354,12 +352,12 @@ func PeopleSearch(params PeopleSearchParams) (PeopleSearchResults, error) {
|
|||
%s
|
||||
%s
|
||||
%s
|
||||
GROUP BY people.id, Section__name
|
||||
GROUP BY people.id
|
||||
ORDER BY CONCAT(people.last_name, people.first_name) ASC
|
||||
%s
|
||||
`, sqlQuery, sqlFieldJoins, sqlFilters, sqlPagination)
|
||||
|
||||
sqlResult := db.Raw(sqlQuery, sqlParams...).Scan(&results.Results)
|
||||
sqlResult := db.Raw(sqlQuery, sqlParams...).Preload("Section").Find(&results.Results)
|
||||
if sqlResult.Error != nil {
|
||||
return results, sqlResult.Error
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue