p2panda / aquadoggo

Node for the p2panda network handling validation, storage, aggregation and replication
GNU Affero General Public License v3.0
69 stars 5 forks source link

Fix pagination bug when only one field is selected and sorted at the same time #593

Closed adzialocha closed 10 months ago

adzialocha commented 10 months ago

This PR fixes the issue we had when pagination suddenly broke for a query over one single sorted field.

We usually order by:

  1. The field which was selected by the user to-be-ordered
  2. document view id (except of when it was previously selected)
  3. Cursor

Two things are important in this context:

When multiple fields have been selected by the user and we have duplicate values:

When one field has been selected and we have duplicate values there's an issue:

To fix this we simply just don't order by document id when sorting over one field!

Closes https://github.com/p2panda/aquadoggo/issues/583

📋 Checklist

codecov[bot] commented 10 months ago

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (1a7cefc) 92.70% compared to head (4fd90dc) 92.79%.

Files Patch % Lines
aquadoggo/src/db/stores/query.rs 92.85% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #593 +/- ## ========================================== + Coverage 92.70% 92.79% +0.09% ========================================== Files 106 106 Lines 18405 18623 +218 ========================================== + Hits 17062 17281 +219 + Misses 1343 1342 -1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.