Photo: Allow overwriting estimated locations #918
This commit is contained in:
parent
1580604f2c
commit
9dad595c3e
3 changed files with 4 additions and 4 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue