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

Include resources on maps only when the geocoding got valid coords #8037

Merged
merged 1 commit into from May 24, 2021

Conversation

leio10
Copy link
Contributor

@leio10 leio10 commented May 24, 2021

🎩 What? Why?

For in-person meetings, it is not allowed to leave the address field empty, or with a value that can't be located in the geocoding service database. But online meetings allow admins to leave it empty, and in that case the geocoding library stores NaN for the longitude and latitude fields. As these values are not nil or false, the geocoded? method returns true, even when those values are not valid. This results in the meetings map to raise a JS error and to appear completely empty, as explained in #7983.

This PR adds a new method geocoded_and_valid? that is used to avoid trying to paint the online meetings on the map. I didn't override the geocoded? method because it could be used by the library to try to geocode the meeting again if it returns false.

📌 Related Issues

Testing

  1. Configure the maps service for Decidim
  2. Add an in-person meeting and an online meeting to a meetings component
  3. Go to the meetings component front page and check that the map shows the in-person meeting properly

@leio10 leio10 self-assigned this May 24, 2021
@leio10 leio10 added module: meetings type: fix PRs that implement a fix for a bug module: core labels May 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: core module: meetings type: fix PRs that implement a fix for a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Meeting map does not show meetings when there are online and in-person meetings
2 participants