Skip to content

Conversation

@vib-adhoc
Copy link

Problem:
In some environments, the last_batchs field was returning batches in a non-deterministic order, even though the backend query was intended to sort them by most recent first. This was due to the use of PostgreSQL's ARRAY_AGG function without an explicit ORDER BY clause, which does not guarantee the order of elements in the resulting array.

This caused the frontend to display batches in the wrong order, despite the backend shell showing them correctly, leading to confusion and inconsistent UI behavior.

Solution:
Explicitly specify the order in the ARRAY_AGG function within the SQL query used in _compute_last_batchs. By adding ORDER BY batch.id DESC, we ensure that the array of batch IDs is always sorted from newest to oldest, matching the intended logic and the backend results.

@C3POdoo C3POdoo requested a review from a team September 10, 2025 19:04
@vib-adhoc
Copy link
Author

@d-fence Hello Christophe, could you please take a look at this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant