Skip to content

withinPolygon: 3 point minimum and boundary testing. #3889

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

Merged
merged 5 commits into from
May 31, 2017
Merged

withinPolygon: 3 point minimum and boundary testing. #3889

merged 5 commits into from
May 31, 2017

Conversation

dplewis
Copy link
Member

@dplewis dplewis commented May 31, 2017

Mongo has a 3 point minimum for $polygon and throws an error.

Also withinPolygon and withinGeoBox are inclusive

They return within and on bounds. Updated test for inclusion

@codecov
Copy link

codecov bot commented May 31, 2017

Codecov Report

Merging #3889 into master will decrease coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3889      +/-   ##
==========================================
- Coverage   90.27%   90.24%   -0.04%     
==========================================
  Files         114      114              
  Lines        7578     7582       +4     
==========================================
+ Hits         6841     6842       +1     
- Misses        737      740       +3
Impacted Files Coverage Δ
src/Adapters/Storage/Mongo/MongoTransform.js 83.19% <100%> (-0.15%) ⬇️
...dapters/Storage/Postgres/PostgresStorageAdapter.js 95.69% <100%> (-0.13%) ⬇️
src/RestWrite.js 93.12% <0%> (-0.2%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9ad8697...f3e81d7. Read the comment docs.

Copy link
Contributor

@flovilmart flovilmart left a comment

Choose a reason for hiding this comment

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

A few nits here and there, otherwise, it looks great!

if (polygon.length < 3) {
throw new Parse.Error(
Parse.Error.INVALID_JSON,
'Polygon must have at least 3 points'
Copy link
Contributor

Choose a reason for hiding this comment

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

can you be more explicit on that: ex:

bad $geoWithin value; $polygon should contain at least 3 GeoPoints

@@ -623,6 +623,12 @@ function transformConstraint(constraint, inArray) {
if (!(polygon instanceof Array)) {
throw new Parse.Error(Parse.Error.INVALID_JSON, 'bad $geoWithin value');
Copy link
Contributor

Choose a reason for hiding this comment

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

can we be more specific here with:

bad $geoWithin value; $polygon should contain at least 3 GeoPoints

if (polygon.length < 3) {
throw new Parse.Error(
Parse.Error.INVALID_JSON,
'Polygon must have at least 3 points'
Copy link
Contributor

Choose a reason for hiding this comment

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

same here :)

@dplewis
Copy link
Member Author

dplewis commented May 31, 2017

I've added an additional test for open vs closed polygons. They both are supported

@flovilmart flovilmart merged commit e8be98d into parse-community:master May 31, 2017
@dplewis
Copy link
Member Author

dplewis commented May 31, 2017

Thanks

@dplewis dplewis deleted the polygon-test branch May 31, 2017 22:10
@flovilmart flovilmart modified the milestone: 2.5.0 Jun 25, 2017
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