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

State fails to locate objects given a location #288

Closed
jwaa opened this issue May 16, 2021 · 1 comment
Closed

State fails to locate objects given a location #288

jwaa opened this issue May 16, 2021 · 1 comment
Assignees
Labels
bug Something isn't working core Work related to the core functionality

Comments

@jwaa
Copy link
Member

jwaa commented May 16, 2021

Describe the bug
State[{"location":(1,1)}] or its more readable equivalent State.get_with_property({"location":(1,1)}, combined=True) fails to return the correct objects (in this example all objects at location 1,1).

To Reproduce

objects_at_loc = State[{"location":(1,1)}]

Expected behavior
To only return the objects actually at that location, not a list of objects that have seemingly nothing in common.

Screenshots
N/A

Stacktrace
N/A

Additional context
Came across this bug when we tested #202

@jwaa jwaa added the bug Something isn't working label May 16, 2021
@jwaa
Copy link
Member Author

jwaa commented May 16, 2021

This behaviour is caused by how State functions when queried like this:

objs = State[{"foo": ["bar1", "bar2"] }]

In this case the State will look for all objects that have the property "foo" with as value "bar1" or "bar2". In the case of the location it will thus search for all objects that have 1 or 1 as its value. Returning all objects that have 1 as either their x- or y-coordinate.

A straightforward fix is to tackle the location property as an outlier and treat its value (in the example (1,1)) as is, instead of as a list of potential values allowed.

@jwaa jwaa self-assigned this May 16, 2021
@jwaa jwaa added this to the Release v2.1.0 milestone May 16, 2021
@jwaa jwaa added the core Work related to the core functionality label May 16, 2021
@jwaa jwaa closed this as completed May 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working core Work related to the core functionality
Projects
None yet
Development

No branches or pull requests

1 participant