Photo: Allow overwriting estimated locations #918

This commit is contained in:
Michael Mayer 2021-01-19 11:38:35 +01:00
parent 1580604f2c
commit 9dad595c3e
3 changed files with 4 additions and 4 deletions

View file

@ -897,7 +897,7 @@ func (m *Photo) SetCoordinates(lat, lng float32, altitude int, source string) {
return return
} }
if m.PlaceSrc != SrcAuto && m.PlaceSrc != source && source != SrcManual { if SrcPriority[source] < SrcPriority[m.PlaceSrc] && m.HasLatLng() {
return return
} }

View file

@ -793,7 +793,7 @@ var PhotoFixtures = PhotoMap{
Cell: &UnknownLocation, Cell: &UnknownLocation,
PlaceID: UnknownPlace.ID, PlaceID: UnknownPlace.ID,
CellID: UnknownLocation.ID, CellID: UnknownLocation.ID,
PlaceSrc: "location", PlaceSrc: SrcLocation,
TimeZone: "", TimeZone: "",
PhotoCountry: UnknownCountry.ID, PhotoCountry: UnknownCountry.ID,
PhotoYear: 0, PhotoYear: 0,

View file

@ -598,7 +598,7 @@ func TestPhoto_SetCoordinates(t *testing.T) {
assert.Equal(t, float32(1.234), m.PhotoLat) assert.Equal(t, float32(1.234), m.PhotoLat)
assert.Equal(t, float32(4.321), m.PhotoLng) assert.Equal(t, float32(4.321), m.PhotoLng)
assert.Equal(t, 3, m.PhotoAltitude) 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(1.234), m.PhotoLat)
assert.Equal(t, float32(4.321), m.PhotoLng) assert.Equal(t, float32(4.321), m.PhotoLng)
assert.Equal(t, 3, m.PhotoAltitude) 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(1.234), m.PhotoLat)
assert.Equal(t, float32(4.321), m.PhotoLng) assert.Equal(t, float32(4.321), m.PhotoLng)
assert.Equal(t, 3, m.PhotoAltitude) 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.PhotoLat)
assert.Equal(t, float32(5.555), m.PhotoLng) assert.Equal(t, float32(5.555), m.PhotoLng)
assert.Equal(t, 5, m.PhotoAltitude) assert.Equal(t, 5, m.PhotoAltitude)