Closed tfeseker closed 1 year ago
It is possible to create single observations using the create() method of the service class. It takes an instance of any entity (things, datastreams, etc.) including an observation
Unfortunately, that did not work.
My understanding is that the create method of the service class calls the get dao method of the entity class that is about to be created. For all classes except Observation, this leads to the create method of the superclass base dao. For observations, though, there is a class method create. This method currently seems to expect a data array. When trying to create a single observation, there was an uncaught error that "data_array does not have a property 'value'".
My suggestion tests first if the object is a single observation. If true, it calls the create method of the super class, just like what happens for all other entity types. If false, the methods assumes that the passed value is a data array - just like the current version.
I took another look today and you are correct, the create() method didn't work for single observations previously. Thanks for spotting the error and correcting it!
It was not possible to create single observations.
The create method of the ObservationDao only accepted data arrays. I have inserted a switch to make it possible to create single observations or data arrays.