Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DiaryEntryController.list #1612

Closed
lelelelemon opened this issue Aug 15, 2017 · 4 comments
Closed

DiaryEntryController.list #1612

lelelelemon opened this issue Aug 15, 2017 · 4 comments

Comments

@lelelelemon
Copy link

The location for diaryEntry can be previously stored into the database, since the value used to calculate it will keep non-changed.

@tomhughes
Copy link
Member

Sorry, but I don't understand what you mean. Can you explain a bit more fully?

@lelelelemon
Copy link
Author

lelelelemon commented Aug 15, 2017

Sorry to make you confused, what I want to say is in your _location.html.erb:
<%= t 'diary_entry.location.location' %>

<a href="<%= url_for :controller => 'site', :action => 'index', :anchor => "map=14/#{location.latitude}/#{location.longitude}" %>">

<%= describe_location location.latitude, location.longitude, 14, location.language_code %>

every diary, will call "describe_location location.latitude, location.longitude, 14, location.language_code" to get the real location, which is quite time consuming, why don't directly store this value into database

@tomhughes
Copy link
Member

It doesn't actually call nominatim every time as the results are cached - see https://github.com/openstreetmap/openstreetmap-website/blob/master/lib/nominatim.rb#L8 for details.

The main advantage to not storing it in the database is that it allows the description to improve over time as our data improves - the cache means it won't update immediately but it will age out eventually or sometimes the caches are purged for various reasons.

@lelelelemon
Copy link
Author

but i still think the frequency to change it is very small

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants