Places: Change sort order for showing nearby photos in viewer
This commit is contained in:
parent
2d350c190f
commit
6c51049bf7
|
@ -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,
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue