Skip to content

Commit

Permalink
fix: Querying using findAll may return inacurrate results (#162)
Browse files Browse the repository at this point in the history
* fix: Querying using findAll may return inacurrate results

* nit

* try watchOS test

* revert
  • Loading branch information
cbaker6 authored Mar 12, 2024
1 parent 0485a6b commit 702ca34
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@
# Parse-Swift Changelog

### main
[Full Changelog](https://github.com/netreconlab/Parse-Swift/compare/5.9.1...main), [Documentation](https://swiftpackageindex.com/netreconlab/Parse-Swift/main/documentation/parseswift)
[Full Changelog](https://github.com/netreconlab/Parse-Swift/compare/5.9.2...main), [Documentation](https://swiftpackageindex.com/netreconlab/Parse-Swift/main/documentation/parseswift)
* _Contributing to this repo? Add info about your change here to be included in the next release_


### 5.9.2
[Full Changelog](https://github.com/netreconlab/Parse-Swift/compare/5.9.1...5.9.2), [Documentation](https://swiftpackageindex.com/netreconlab/Parse-Swift/5.9.2/documentation/parseswift)

__Fixes__
* Querying using findAll may be inacurrate when results are greater than the batch limit ([#161](https://github.com/netreconlab/Parse-Swift/pull/161)), thanks to [Corey Baker](https://github.com/cbaker6).

### 5.9.1
[Full Changelog](https://github.com/netreconlab/Parse-Swift/compare/5.9.0...5.9.1), [Documentation](https://swiftpackageindex.com/netreconlab/Parse-Swift/5.9.1/documentation/parseswift)

Expand Down
2 changes: 1 addition & 1 deletion Sources/ParseSwift/ParseConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation

enum ParseConstants {
static let sdk = "swift"
static let version = "5.9.1"
static let version = "5.9.2"
static let fileManagementDirectory = "parse/"
static let fileManagementPrivateDocumentsDirectory = "Private Documents/"
static let fileManagementLibraryDirectory = "Library/"
Expand Down
4 changes: 3 additions & 1 deletion Sources/ParseSwift/Types/Query.swift
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ extension Query: Queryable {
var query = self
.order([.ascending("objectId")])
query.limit = limit ?? ParseConstants.batchLimit
let originalQueryWhere = query.where
var results = [ResultType]()
var finished = false
while !finished {
Expand All @@ -593,8 +594,9 @@ extension Query: Queryable {
results.append(contentsOf: currentResults)
if currentResults.count >= query.limit {
guard let lastObjectId = results[results.count - 1].objectId else {
throw ParseError(code: .otherCause, message: "Last object should have an id.")
throw ParseError(code: .otherCause, message: "Last object should have an objectId.")
}
query.where = originalQueryWhere
query.where.add("objectId" > lastObjectId)
} else {
finished = true
Expand Down

0 comments on commit 702ca34

Please sign in to comment.