Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-FAIR
Commits
2b020c02
Commit
2b020c02
authored
Jan 16, 2021
by
Markus Scheidgen
Browse files
Fixed HTTP 500 on order_by non str quantities in entry v1 API.
#468
parent
73bb98d4
Changes
2
Hide whitespace changes
Inline
Side-by-side
nomad/search.py
View file @
2b020c02
...
...
@@ -1058,7 +1058,8 @@ def _es_to_api_aggregation(es_response, name: str, agg: Aggregation) -> Aggregat
if
order_by
is
None
:
pagination
.
next_after
=
after_key
[
name
]
else
:
pagination
.
next_after
=
':'
.
join
(
after_key
.
to_dict
().
values
())
str_values
=
[
str
(
v
)
for
v
in
after_key
.
to_dict
().
values
()]
pagination
.
next_after
=
':'
.
join
(
str_values
)
return
AggregationResponse
(
data
=
agg_data
,
pagination
=
pagination
,
**
aggregation_dict
)
...
...
tests/app/v1/routers/test_entries.py
View file @
2b020c02
...
...
@@ -519,7 +519,9 @@ def test_entries_all_statistics(client, data):
@
pytest
.
mark
.
parametrize
(
'aggregation, total, size, status_code'
,
[
pytest
.
param
({
'quantity'
:
'upload_id'
,
'pagination'
:
{
'order_by'
:
'uploader'
}},
3
,
3
,
200
,
id
=
'order'
),
pytest
.
param
({
'quantity'
:
'upload_id'
,
'pagination'
:
{
'order_by'
:
'uploader'
}},
3
,
3
,
200
,
id
=
'order-str'
),
pytest
.
param
({
'quantity'
:
'upload_id'
,
'pagination'
:
{
'order_by'
:
'upload_time'
}},
3
,
3
,
200
,
id
=
'order-date'
),
pytest
.
param
({
'quantity'
:
'upload_id'
,
'pagination'
:
{
'order_by'
:
'dft.n_calculations'
}},
3
,
3
,
200
,
id
=
'order-int'
),
pytest
.
param
({
'quantity'
:
'dft.labels_springer_classification'
},
0
,
0
,
200
,
id
=
'no-results'
),
pytest
.
param
({
'quantity'
:
'upload_id'
,
'pagination'
:
{
'after'
:
'id_published'
}},
3
,
1
,
200
,
id
=
'after'
),
pytest
.
param
({
'quantity'
:
'upload_id'
,
'pagination'
:
{
'order_by'
:
'uploader'
,
'after'
:
'Sheldon Cooper:id_published'
}},
3
,
1
,
200
,
id
=
'after-order'
),
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment