Skip to content

Commit

Permalink
Correct data_returned for structures/entry_id
Browse files Browse the repository at this point in the history
  • Loading branch information
CasperWA committed Nov 8, 2019
1 parent 17d0af7 commit 534cb70
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 1 addition & 4 deletions optimade/server/entry_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,7 @@ def find(
results.append(self.resource_cls(**StructureMapper.map_back(doc)))

if isinstance(params, SingleEntryQueryParams):
if len(results) == 1:
results = results[0]
else:
results = None
results = results[0] if results else None

return results, more_data_available, data_available, all_fields - fields

Expand Down
5 changes: 4 additions & 1 deletion optimade/server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,14 @@ def get_single_structure(
links = ToplevelLinks(next=None)
if fields and results is not None:
results = handle_response_fields(results, fields)[0]

data_returned = 1 if results else 0

return StructureResponseOne(
links=links,
data=results,
meta=meta_values(
str(request.url), data_available, data_available, more_data_available
str(request.url), data_returned, data_available, more_data_available
),
)

Expand Down

0 comments on commit 534cb70

Please sign in to comment.