Inventaire edition query: fixed results not sorted
This commit is contained in:
@@ -3,6 +3,7 @@ package inventaire
|
||||
import (
|
||||
"encoding/json"
|
||||
"math"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"git.artlef.fr/PersonalLibraryManager/internal/callapiutils"
|
||||
@@ -131,6 +132,7 @@ func CallInventaireEdition(inventaireId string, lang string, limit int, offset i
|
||||
return queryResult, err
|
||||
}
|
||||
queryResult.Count = int64(len(uris.Uris))
|
||||
sort.Strings(uris.Uris)
|
||||
limitedUris := uris.Uris
|
||||
if limit != 0 {
|
||||
l := len(uris.Uris)
|
||||
@@ -144,7 +146,12 @@ func CallInventaireEdition(inventaireId string, lang string, limit int, offset i
|
||||
return queryResult, err
|
||||
}
|
||||
|
||||
for _, entity := range editionEntities.Entities {
|
||||
sortedEntities := editionEntities.Entities
|
||||
sort.Slice(sortedEntities, func(i, j int) bool {
|
||||
return sortedEntities[i].Uri < sortedEntities[j].Uri
|
||||
})
|
||||
|
||||
for _, entity := range sortedEntities {
|
||||
publisher := ""
|
||||
if entity.EditionId != "" {
|
||||
publisher, err = callInventairePublisherGetName(entity.EditionId, lang)
|
||||
|
||||
Reference in New Issue
Block a user