schollz / find

High-precision indoor positioning framework for most wifi-enabled devices.
https://www.internalpositioning.com/
GNU Affero General Public License v3.0
5.03k stars 370 forks source link

Get user location api call does not work properly #175

Open DorianTe opened 6 years ago

DorianTe commented 6 years ago

Whenever i execute this command:

curl -X GET http://localhost:8003/location?group=TESTGROUP&user=dorian

It returns the following information:

{"message":"Correctly found locations.","success":true,"users":{"dorian":[{"time":"2017-09-20 11:47:22.501935543 +0000 UTC","location":"office","bayes":{"kantine":-0.7071067811865475,"office":0.7071067811865476},"svm":{"kantine":-2.2507614392718738,"office":-0.11128804882262555},"rf":null}], "ian":[{"time":"2017-09-20 10:42:48.528923721 +0000 UTC","location":"office","bayes":{"kantine":-0.7071067811865475,"office":0.7071067811865476},"svm":{"kantine":-3.235615148872499,"office":-0.04013056694473616},"rf":null}]}}

As you can see it returns all users (there are only 2 users) in the group instead of only user "dorian".

iam not a go-lang pro but i took a dive into the code and think the culprit is the foreach loop in getUserLocations function in api.go. (but then again iam very inexperienced with go-lang so i could be wrong.)

schollz commented 6 years ago

That's very strange. Would you be able to send me your database? Email to hypercube.platforms@gmail.com