rodekruis/shelter-database

Property API

Closed this issue · 2 comments

Hi @cedricbonhomme,

There seems to be in issue in the old code with adding a new property, and after that updating the value of that property. When a new property is added, the property_id is returned and is used to set the value-id in the edit.html. However, this is the wrong id. You can test is on shelter-database.org by creating a new shelter, and then first set the latitude and then afterwards change that same latitude field. The Value API will throw a not-found error.

hello, yes I see what you are talking about. I just tested on your example (http://shelter-database.org/shelter/edit/124/General-Information). I can try to fix if you want. I'll keep you up to date.

The problem is here:
https://github.com/rodekruis/shelter-database/blob/master/src/web/static/js/edit-shelter.js#L41

As you said, this is not the good id. The id should be something like result.values[0].id. Since we want the id of the new value associated to this property.
the bug is that the value of a property is then used to call the /api/value endpoint of the API.