diff --git a/internal/entity/photo.go b/internal/entity/photo.go index 72a606167..762b3932f 100644 --- a/internal/entity/photo.go +++ b/internal/entity/photo.go @@ -897,7 +897,7 @@ func (m *Photo) SetCoordinates(lat, lng float32, altitude int, source string) { return } - if m.PlaceSrc != SrcAuto && m.PlaceSrc != source && source != SrcManual { + if SrcPriority[source] < SrcPriority[m.PlaceSrc] && m.HasLatLng() { return } diff --git a/internal/entity/photo_fixtures.go b/internal/entity/photo_fixtures.go index 5678b51d6..e4fbf3e11 100644 --- a/internal/entity/photo_fixtures.go +++ b/internal/entity/photo_fixtures.go @@ -793,7 +793,7 @@ var PhotoFixtures = PhotoMap{ Cell: &UnknownLocation, PlaceID: UnknownPlace.ID, CellID: UnknownLocation.ID, - PlaceSrc: "location", + PlaceSrc: SrcLocation, TimeZone: "", PhotoCountry: UnknownCountry.ID, PhotoYear: 0, diff --git a/internal/entity/photo_test.go b/internal/entity/photo_test.go index 88379ec35..ac52dcf0e 100644 --- a/internal/entity/photo_test.go +++ b/internal/entity/photo_test.go @@ -598,7 +598,7 @@ func TestPhoto_SetCoordinates(t *testing.T) { assert.Equal(t, float32(1.234), m.PhotoLat) assert.Equal(t, float32(4.321), m.PhotoLng) assert.Equal(t, 3, m.PhotoAltitude) - m.SetCoordinates(5.555, 5.555, 5, SrcImage) + m.SetCoordinates(5.555, 5.555, 5, SrcName) assert.Equal(t, float32(1.234), m.PhotoLat) assert.Equal(t, float32(4.321), m.PhotoLng) assert.Equal(t, 3, m.PhotoAltitude) @@ -608,7 +608,7 @@ func TestPhoto_SetCoordinates(t *testing.T) { assert.Equal(t, float32(1.234), m.PhotoLat) assert.Equal(t, float32(4.321), m.PhotoLng) assert.Equal(t, 3, m.PhotoAltitude) - m.SetCoordinates(5.555, 5.555, 5, "location") + m.SetCoordinates(5.555, 5.555, 5, SrcLocation) assert.Equal(t, float32(5.555), m.PhotoLat) assert.Equal(t, float32(5.555), m.PhotoLng) assert.Equal(t, 5, m.PhotoAltitude)