Skip to content

Commit 9395456

Browse files
authored
The sorting added for unique values of ComponentAttribute (#136)
The sorting added for unique values of ComponentAttribute #135 In the test database there are three attributes in a row with the Global region, before the attribute with the NL region. I added ascending sort to get unique attribute values in sqlalchemy query. Reviewed-by: Anton Sidelnikov
1 parent 5ea648a commit 9395456

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

app/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,9 @@ def get_unique_values(attr):
257257
return [
258258
r[0]
259259
for r in db.session.execute(
260-
select(ComponentAttribute.value).where(
261-
ComponentAttribute.name == attr
262-
)
260+
select(ComponentAttribute.value)
261+
.where(ComponentAttribute.name == attr)
262+
.order_by(ComponentAttribute.value.asc())
263263
)
264264
.unique()
265265
.all()

0 commit comments

Comments
 (0)