diff --git a/backend/zeno_backend/database/select.py b/backend/zeno_backend/database/select.py index fbf730c8..1b3fb039 100644 --- a/backend/zeno_backend/database/select.py +++ b/backend/zeno_backend/database/select.py @@ -1920,10 +1920,17 @@ async def table_data_paginated( if sort == "": sort = "diff" - order_sql = sql.SQL("ORDER BY {} {}").format( - sql.Identifier(sort), - sql.SQL("DESC" if req.sort[1] else "ASC"), - ) + if req.sort[0].data_type == MetadataType.NOMINAL: + order_sql = sql.SQL("ORDER BY {} COLLATE numeric {}").format( + sql.Identifier(sort), + sql.SQL("ASC" if req.sort[1] else "DESC"), + ) + else: + order_sql = sql.SQL("ORDER BY {} {}").format( + sql.Identifier(sort), + sql.SQL("ASC" if req.sort[1] else "DESC"), + ) + else: await cur.execute( sql.SQL("SELECT column_id FROM {} WHERE type = 'ID';").format( diff --git a/frontend/src/lib/components/project/home/elements/ListElement.svelte b/frontend/src/lib/components/project/home/elements/ListElement.svelte index d8d584d0..635d3c8a 100644 --- a/frontend/src/lib/components/project/home/elements/ListElement.svelte +++ b/frontend/src/lib/components/project/home/elements/ListElement.svelte @@ -2,10 +2,11 @@ import { goto } from '$app/navigation'; import ListView from '$lib/components/instances/ListView.svelte'; import Select from '$lib/components/ui/Select.svelte'; - import { model, models, project } from '$lib/stores'; + import { columns, model, models, project, sort } from '$lib/stores'; import Button from '@smui/button/src/Button.svelte'; $: sortedModels = $models.sort((a, b) => a.localeCompare(b)); + $: console.log($sort);
@@ -18,6 +19,24 @@ }) ]} /> +

sort by:

+ +
col.columnType === ZenoColumnType.ID), true]); model.subscribe((mod) => { if ($comparisonModel && $comparisonModel === mod) {