Commit 42751187 authored by sarsonl's avatar sarsonl
Browse files

Route which returns specific borehole defined to return JSON object

Previously this route would always return a list, although more
than one JSON boject would never be returned.
parent 492c2c28
......@@ -81,6 +81,13 @@ class DynamicQuery(object):
except NoResultFound as err:
return None
def return_one(self):
"""Returns one result from query.
:rtype: dict
return self.query.one_or_none()
def paginate_query(self, limit, page=None, error_flag=False):
"""Paginate used to return a subset of results, starting from
offset*limit to offset*limit + limit.
......@@ -143,7 +143,7 @@ class BoreholeHydraulicSampleListResource(ResourceBase):
# TODO(damb): Serialize according to query_param format=JSON|XML
# format response
resp = BoreholeSchema(many=True).dumps(resp)
resp = BoreholeSchema().dumps(resp)
return make_response(resp, settings.MIMETYPE_JSON)
......@@ -181,7 +181,7 @@ class BoreholeHydraulicSampleListResource(ResourceBase):
# next_url, has_next.
return paginate_obj.items
return dynamic_query.return_all()
return dynamic_query.return_one()
class SectionHydraulicSampleListResource(ResourceBase):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment