Places: Change sort order for showing nearby photos in viewer

This commit is contained in:
Michael Mayer 2021-11-26 21:24:12 +01:00
parent 2d350c190f
commit 6c51049bf7
2 changed files with 2 additions and 2 deletions

View file

@ -902,7 +902,7 @@ var FileFixtures = FileMap{
FileCodec: "jpeg",
FileType: "raw",
FileMime: "image/x-canon-cr2",
FilePrimary: true,
FilePrimary: false,
FileSidecar: false,
FileVideo: false,
FileMissing: false,

View file

@ -345,7 +345,7 @@ func Geo(f form.SearchGeo) (results GeoResults, err error) {
// Sort order.
if f.Near != "" {
// Sort by distance to UID.
s = s.Order(gorm.Expr("(photos.photo_uid = ?) DESC, ABS((? - photos.photo_lat)*(? - photos.photo_lng))", f.Near, f.Lat, f.Lng))
s = s.Order(gorm.Expr("(photos.photo_uid = ?) DESC, ABS(? - photos.photo_lat)+ABS(? - photos.photo_lng)", f.Near, f.Lat, f.Lng))
s = s.Limit(1000)
} else {
// Default.