elsa-core
elsa-core copied to clipboard
Wrong ordering/pagination in WorkflowExecutionLogStore
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
Nice catch @dhanke-saio 👍🏻