-
Notifications
You must be signed in to change notification settings - Fork 32
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
Filter locations in API by location_on_map
field
#1342
Conversation
location_on_map
field
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, congratz to your first PR 🎉 🚀 😍
In general, this looks very good and does exactly what we want. 👍
I have a few ideas for improvement:
- We could filter the locations in the database query instead of the python loop - see my comment below
- Changes to the database structure require migration files to ensure that all existing databases can adapt to the new structure. In your local repository clone, there should appear a new file in the
integreat_cms/cms/migrations/
directory which you need to add to your commit as well. If no such file was generated automatically, please execute the dev tool./dev-tools/migrate.sh
. See the Django documentation for more information.
Code Climate has analyzed commit 7ab3c0e and detected 1 issue on this pull request. Here's the issue category breakdown:
The test coverage on the diff in this pull request is 66.6% (50% is the threshold). This pull request will bring the total coverage in the repository to 73.8% (-0.1% change). View more on Code Climate. |
Actually I think I messed around a little too much with the migration files. I wasn't sure what they were doing at first, so I did a bit of unnecessary back and forth editing. I tried to get things as clean as possible, but I always ended up creating at least 2 migration files. Is that right? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your changes! 💪
Apart from my comment below, we also have to fix the CircleCI build for this PR:
At the moment, there are two problems:
- The black code style is not applied - you can do this with the dev tool
./dev-tools/black.sh
- in the future, I recommend using our pre-commit hooks for this (which can be installed viapipenv run pre-commit install
), but if you face any issues with them, you might as well execute the dev tool manually before you commit. - The pylint code linter finds a few problems - a missing import and two missing docstrings. The docstring should be fixed with my suggestion, and for the import you need to add the line:
to the top of the locations api file as stated in my previous comment.
from distutils.util import strtobool
integreat_cms/cms/migrations/0016_rename_location_not_on_map_poi_location_on_map.py
Outdated
Show resolved
Hide resolved
integreat_cms/cms/migrations/0016_rename_location_not_on_map_poi_location_on_map.py
Outdated
Show resolved
Hide resolved
integreat_cms/cms/migrations/0016_rename_location_not_on_map_poi_location_on_map.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
I have one small suggestion left, and then this PR is almost ready to be merged 🎉
After that, please resolve the conflicts with the base branch by executing
git checkout develop
git pull
git checkout feature/location-on-map
git rebase develop
./dev-tools/resolve_translation_conflicts.sh
git rebase --continue
git push --force-with-lease
Then, after that it would be cool if you could clean up the git history a bit and combined your commits into one:
git rebase --interactive $(git merge-base --fork-point origin/develop $(git rev-parse --abbrev-ref HEAD))
# in the editor, replace "pick" by "fixup" in every line except the first one
git rebase --continue
git push --force-with-lease
integreat_cms/cms/migrations/0016_rename_location_not_on_map_poi_location_on_map.py
Outdated
Show resolved
Hide resolved
40ef29a
to
a04d97e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks a lot! 💪
Oh sorry, and one thing I forgot:
Could you add exactly one line at the bottom of the "UNRELEASED" of our CHANGELOG with a note of this change? Thanks!
(If you don't want to repeat the git-clean-process, you can just use git commit --no-edit --amend
together with git push --force-with-lease
)
integreat_cms/cms/migrations/0021_rename_location_not_on_map_poi_location_on_map.py
Outdated
Show resolved
Hide resolved
8e857f5
to
f2858ed
Compare
okay, I think I'm done :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Just a tiny little detail, but I think that's it 🙂
f2858ed
to
143f1a7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Damn, I just wanted to approve this PR, when I noticed that I used the old field recentlly when changing the POI coordinates...
Could you change this line
if not cleaned_data.get("location_not_on_map"): |
to:
if cleaned_data.get("location_on_map"):
?
Sorry about all the small incremental change requests 😒
143f1a7
to
7ab3c0e
Compare
You're good, I didn't notice either. :D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing, I think that's it 🎉 🥂
Now press that merge button before I find something else 😆
🍾 |
Short description
Change location_not_on_map attribute of POIs to location_on_map and use it in api endpoints.
Resolved issues
Fixes: #1038