Metadata: Rename SetTimeZone to UpdateTimeZone #930

This commit is contained in:
Michael Mayer 2021-01-27 23:39:46 +01:00
parent 480b186b3c
commit b55c06dca1
3 changed files with 9 additions and 9 deletions

View file

@ -901,8 +901,8 @@ func (m *Photo) SetTakenAt(taken, local time.Time, zone, source string) {
m.UpdateDateFields()
}
// SetTimeZone updates the time zone.
func (m *Photo) SetTimeZone(zone string) {
// UpdateTimeZone updates the time zone.
func (m *Photo) UpdateTimeZone(zone string) {
if zone == "" || zone == time.UTC.String() {
return
}

View file

@ -77,13 +77,13 @@ func (m *Photo) EstimatePlace() {
m.PlaceID = recentPhoto.PlaceID
m.PhotoCountry = recentPhoto.PhotoCountry
m.PlaceSrc = SrcEstimate
m.SetTimeZone(recentPhoto.TimeZone)
m.UpdateTimeZone(recentPhoto.TimeZone)
log.Debugf("photo: approximate position of %s is %s (id %s)", m, txt.Quote(m.CountryName()), recentPhoto.PlaceID)
} else if recentPhoto.HasCountry() {
m.PhotoCountry = recentPhoto.PhotoCountry
m.PlaceSrc = SrcEstimate
m.SetTimeZone(recentPhoto.TimeZone)
m.UpdateTimeZone(recentPhoto.TimeZone)
log.Debugf("photo: probable country for %s is %s", m, txt.Quote(m.CountryName()))
} else {

View file

@ -640,7 +640,7 @@ func TestPhoto_SetTakenAt(t *testing.T) {
})
}
func TestPhoto_SetTimeZone(t *testing.T) {
func TestPhoto_UpdateTimeZone(t *testing.T) {
t.Run("UTC", func(t *testing.T) {
m := PhotoFixtures.Get("Photo12")
m.TimeZone = "UTC"
@ -653,7 +653,7 @@ func TestPhoto_SetTimeZone(t *testing.T) {
assert.Equal(t, takenAt, m.TakenAt)
assert.Equal(t, takenAtLocal, m.TakenAtLocal)
m.SetTimeZone(zone)
m.UpdateTimeZone(zone)
assert.Equal(t, takenAt, m.TakenAt)
assert.Equal(t, m.GetTakenAtLocal(), m.TakenAtLocal)
@ -671,7 +671,7 @@ func TestPhoto_SetTimeZone(t *testing.T) {
assert.Equal(t, takenAtLocal, m.TakenAtLocal)
assert.Equal(t, "", m.TimeZone)
m.SetTimeZone(zone)
m.UpdateTimeZone(zone)
assert.Equal(t, m.GetTakenAt(), m.TakenAt)
assert.Equal(t, takenAtLocal, m.TakenAtLocal)
@ -691,7 +691,7 @@ func TestPhoto_SetTimeZone(t *testing.T) {
assert.Equal(t, takenAtLocal, m.TakenAtLocal)
assert.Equal(t, "Europe/Berlin", m.TimeZone)
m.SetTimeZone(zone)
m.UpdateTimeZone(zone)
assert.Equal(t, m.GetTakenAt(), m.TakenAt)
assert.Equal(t, takenAtLocal, m.TakenAtLocal)
@ -712,7 +712,7 @@ func TestPhoto_SetTimeZone(t *testing.T) {
assert.Equal(t, takenAtLocal, m.TakenAtLocal)
assert.Equal(t, "Europe/Berlin", m.TimeZone)
m.SetTimeZone(zone)
m.UpdateTimeZone(zone)
assert.Equal(t, takenAt, m.TakenAt)
assert.Equal(t, takenAtLocal, m.TakenAtLocal)