Skip to content

Commit 52a682b

Browse files
fix: Around precision url component conversion issue (#765)
* replace AroundPrecision fields type Double to Int
1 parent 58ad2eb commit 52a682b

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Sources/AlgoliaSearchClient/Models/Search/Query/Auxiliary/AroundPrecision.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import Foundation
99

1010
public struct AroundPrecision: Codable, Equatable {
1111

12-
public let from: Double
13-
public let value: Double
12+
public let from: Int
13+
public let value: Int
1414

15-
public init(from: Double, value: Double) {
15+
public init(from: Int, value: Int) {
1616
self.from = from
1717
self.value = value
1818
}
@@ -21,9 +21,9 @@ public struct AroundPrecision: Codable, Equatable {
2121

2222
extension AroundPrecision: ExpressibleByIntegerLiteral {
2323

24-
public init(integerLiteral value: UInt) {
24+
public init(integerLiteral value: Int) {
2525
self.from = 0
26-
self.value = Double(value)
26+
self.value = value
2727
}
2828

2929
}
@@ -32,7 +32,7 @@ extension AroundPrecision: ExpressibleByFloatLiteral {
3232

3333
public init(floatLiteral value: Double) {
3434
self.from = 0
35-
self.value = value
35+
self.value = Int(value)
3636
}
3737

3838
}

Tests/AlgoliaSearchClientTests/Unit/QueryTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class QueryTests: XCTestCase {
124124
"aroundLatLng=79.5,10.5",
125125
"aroundLatLngViaIP=true",
126126
"aroundRadius=80",
127-
"aroundPrecision=%5B%7B%22from%22:0.0,%22value%22:1000.0%7D,%7B%22from%22:0.0,%22value%22:100000.0%7D%5D",
127+
"aroundPrecision=%5B%7B%22from%22:0,%22value%22:1000%7D,%7B%22from%22:0,%22value%22:100000%7D%5D",
128128
"minimumAroundRadius=40",
129129
"insideBoundingBox=%5B%5B0.0,10.0,20.0,30.0%5D,%5B40.0,50.0,60.0,70.0%5D%5D",
130130
"insidePolygon=%5B%5B0.0,10.0,20.0,30.0,40.0,50.0%5D,%5B10.0,20.0,30.0,40.0,50.0,60.0%5D%5D",

0 commit comments

Comments
 (0)