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

Accept dynamic radius #180

Merged
merged 5 commits into from
Sep 26, 2024
Merged

Accept dynamic radius #180

merged 5 commits into from
Sep 26, 2024

Conversation

kmpoppe
Copy link
Contributor

@kmpoppe kmpoppe commented Sep 19, 2024

Couldn't get any dev environment to run in a short amount of time.
Would this work?

@kmpoppe kmpoppe marked this pull request as draft September 19, 2024 19:55
@thomersch
Copy link
Owner

I just allowed the test suite to run, let's see. Thanks for taking the time to add tests for this.

I must admit, I don't love the two vs. three parameter distinction. I think an extra get query parameter, e.g. around_radius, would be much cleaner.

@kmpoppe kmpoppe changed the title Accept 3 around parts for dynamic radius Accept dynamic radius Sep 24, 2024
@kmpoppe
Copy link
Contributor Author

kmpoppe commented Sep 24, 2024

Updated to it's own parameter. The first run of the Workflow failed, but I couldn't really figure out what it was complaining about, it just threw some very inpolite emojis at me 😂

@thomersch
Copy link
Owner

I told the CI to be nice, but it doesn't seem to listen to me.

The project uses black to enforce consistent formatting and fails the workflow if the code style diverges from it.

Just a minor nitpick: Maybe it'd be nice to have an upper limit for the distance parameter to prevent enormous lookups. Something like 250 km perhaps?

@kmpoppe
Copy link
Contributor Author

kmpoppe commented Sep 24, 2024

I shall take a look at the white spacing later, I might have mixed that up.

250k sounds good, will implement a fail condition.

Handle radius to contain km only, multiply by 1000 when setting filter.
Update tests
@kmpoppe
Copy link
Contributor Author

kmpoppe commented Sep 24, 2024

Well the last test failed because idiot me forgot a : 🤦, I've added an upper bound, and 0 not being a valid value, should've added < 0 as well, but would love to see if black is now happy.

@thomersch thomersch marked this pull request as ready for review September 24, 2024 14:21
@kmpoppe
Copy link
Contributor Author

kmpoppe commented Sep 24, 2024

black still wants to reformat views.py, https://black.vercel.app/ suggest going from 521 to 568 lines, so it's not only my commit that's causing an issue... Do you want to redo views.py completely?

@kmpoppe
Copy link
Contributor Author

kmpoppe commented Sep 26, 2024

I see, black's problem was about me, not about the code itself :-D
Thanks for making it cooperate :)

@thomersch
Copy link
Owner

I ran the formatter locally and it only reformatted some of the changed lines. That web tool probably didn't take into consideration that we allow 120 char line lengths.

Tests are passing, I validated the changes locally. Let's get this deployed! Thanks!

@thomersch thomersch merged commit 62adb9c into thomersch:master Sep 26, 2024
2 checks passed
@kmpoppe
Copy link
Contributor Author

kmpoppe commented Sep 26, 2024

Don't mention it, it's you allowing a change that was just a preparation for a long process ahead :-)

@kmpoppe
Copy link
Contributor Author

kmpoppe commented Sep 26, 2024

Works pefectly!
https://osmcal.org/?around=54.6558,10.0255&around_radius=97 => zero results
https://osmcal.org/?around=54.6558,10.0255&around_radius=97.5 => 3 Stammtische in Lübeck, which are in 97.32 km distance!
Nice :)

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

Successfully merging this pull request may close these issues.

2 participants