elsa-core icon indicating copy to clipboard operation
elsa-core copied to clipboard

Wrong ordering/pagination in WorkflowExecutionLogStore

Open dhanke-saio opened this issue 5 months ago • 1 comments

Description

In WorkflowExecutionLogStore (Elsa.EntityFrameworkCore.Modules.Runtime), method FindManyAsync implements ordering after pagination.

Source code:

public async Task<Page<WorkflowExecutionLogRecord>> FindManyAsync<TOrderBy>(WorkflowExecutionLogRecordFilter filter, PageArgs pageArgs, WorkflowExecutionLogRecordOrder<TOrderBy> order, CancellationToken cancellationToken = default)
    {
        var count = await store.QueryAsync(queryable => Filter(queryable, filter), cancellationToken).LongCount();
        var results = await store.QueryAsync(queryable => Filter(queryable, filter).Paginate(pageArgs).OrderBy(order), OnLoadAsync, cancellationToken).ToList();
        return new(results, count);
    }

Expected Behavior

Pagination should be after ordering.

Environment

Latest source code

dhanke-saio avatar Jun 11 '25 12:06 dhanke-saio

Nice catch @dhanke-saio 👍🏻

sfmskywalker avatar Jun 11 '25 19:06 sfmskywalker