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

add nearbyTasksWithinBounds endpoints #1170

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

CollinBeczak
Copy link
Contributor

Needed for maproulette/maproulette3#2552
Adds these two endpoints:

GET     /challenge/:cid/nearby/box/:left/:bottom/:right/:top @org.maproulette.controllers.api.ChallengeController.getNearbyTasksWithinBoundingBox(cid:Long, left:Double, bottom:Double, right:Double, top:Double, limit:Int ?= 5)
GET     /virtualchallenge/:id/nearby/box/:left/:bottom/:right/:top @org.maproulette.controllers.api.VirtualChallengeController.getNearbyTasksWithinBoundingBox(id:Long, left:Double, bottom:Double, right:Double, top:Double, limit:Int ?= 5)

These endpoints allow a user to look at tasks within the set bounds with the same expected results as the other fetchNearbyTasks endpoint.l

ORDER BY ST_Distance(
tasks.location,
ST_SetSRID(ST_MakePoint($centerLon, $centerLat), 4326)
), tasks.status, RANDOM()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for ORDER BY ... RANDOM()? Seems like tie-breaking on something deterministic (like tasks.id) would be preferable since it means that for a given query and DB state the results are deterministic (useful I imagine for unit tests).

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