Backend: Limit place estimates to 36h time difference

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
Michael Mayer 2020-07-24 14:06:26 +02:00
parent 91a1a1ca27
commit 28595497b1

View file

@ -73,8 +73,8 @@ func (m *Photo) EstimatePlace() {
log.Errorf("photo: %s (estimate place)", err.Error())
m.EstimateCountry()
} else {
if days := recentPhoto.TakenAt.Sub(m.TakenAt) / (time.Hour * 24); days < -3 || days > 3 {
log.Debugf("photo: can't estimate position of %s, %d days time difference", m, days)
if hours := recentPhoto.TakenAt.Sub(m.TakenAt) / time.Hour; hours < -36 || hours > 36 {
log.Debugf("photo: can't estimate position of %s, %d hours time difference", m, hours)
} else if recentPhoto.HasPlace() {
m.Place = recentPhoto.Place
m.PlaceID = recentPhoto.PlaceID