Skip to content

Commit

Permalink
fix: Querying all trips from all accounts
Browse files Browse the repository at this point in the history
This query should not sort the accounts,
because since there is a limitBy we can run into a case
where we don't see all the latest trips.
The presence in the .select is not necessary either.
  • Loading branch information
Merkur39 committed Feb 8, 2024
1 parent bf99a47 commit d90cb14
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions src/queries/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,10 @@ export const buildAggregatedTimeseriesQuery = ({ limit } = {}) => ({
$exists: true
}
})
.select([
'cozyMetadata.sourceAccount',
'startDate',
'endDate',
'title',
'aggregation'
])
.indexFields(['cozyMetadata.sourceAccount', 'startDate', 'endDate'])
.sortBy([
{ 'cozyMetadata.sourceAccount': 'desc' },
{ startDate: 'desc' },
{ endDate: 'desc' }
])
.select(['startDate', 'endDate', 'title', 'aggregation'])
// FIXME "endDate" should be removed when https://github.com/cozy/cozy-client/issues/1374 fixed
.indexFields(['startDate', 'endDate'])
.sortBy([{ startDate: 'desc' }])
.limitBy(limit),
options: {
as: `${GEOJSON_DOCTYPE}/limitedBy/${limit}`,
Expand Down

0 comments on commit d90cb14

Please sign in to comment.