@@ -57,20 +57,20 @@ public struct Variant: Codable, JSONEncodable {
5757
5858 public init (
5959 addToCartCount: Int ,
60- addToCartRate: Double ? ,
61- averageClickPosition: Int ? ,
60+ addToCartRate: Double ? = nil ,
61+ averageClickPosition: Int ? = nil ,
6262 clickCount: Int ,
63- clickThroughRate: Double ? ,
63+ clickThroughRate: Double ? = nil ,
6464 conversionCount: Int ,
65- conversionRate: Double ? ,
65+ conversionRate: Double ? = nil ,
6666 currencies: [ String : Currency ] ? = nil ,
6767 description: String ,
6868 estimatedSampleSize: Int ? = nil ,
6969 filterEffects: FilterEffects ? = nil ,
7070 index: String ,
7171 noResultCount: Int ? ,
7272 purchaseCount: Int ,
73- purchaseRate: Double ? ,
73+ purchaseRate: Double ? = nil ,
7474 searchCount: Int ? ,
7575 trackedSearchCount: Int ? = nil ,
7676 trafficPercentage: Int ,
@@ -127,20 +127,20 @@ public struct Variant: Codable, JSONEncodable {
127127 public func encode( to encoder: Encoder ) throws {
128128 var container = encoder. container ( keyedBy: CodingKeys . self)
129129 try container. encode ( self . addToCartCount, forKey: . addToCartCount)
130- try container. encode ( self . addToCartRate, forKey: . addToCartRate)
131- try container. encode ( self . averageClickPosition, forKey: . averageClickPosition)
130+ try container. encodeIfPresent ( self . addToCartRate, forKey: . addToCartRate)
131+ try container. encodeIfPresent ( self . averageClickPosition, forKey: . averageClickPosition)
132132 try container. encode ( self . clickCount, forKey: . clickCount)
133- try container. encode ( self . clickThroughRate, forKey: . clickThroughRate)
133+ try container. encodeIfPresent ( self . clickThroughRate, forKey: . clickThroughRate)
134134 try container. encode ( self . conversionCount, forKey: . conversionCount)
135- try container. encode ( self . conversionRate, forKey: . conversionRate)
135+ try container. encodeIfPresent ( self . conversionRate, forKey: . conversionRate)
136136 try container. encodeIfPresent ( self . currencies, forKey: . currencies)
137137 try container. encode ( self . description, forKey: . description)
138138 try container. encodeIfPresent ( self . estimatedSampleSize, forKey: . estimatedSampleSize)
139139 try container. encodeIfPresent ( self . filterEffects, forKey: . filterEffects)
140140 try container. encode ( self . index, forKey: . index)
141141 try container. encode ( self . noResultCount, forKey: . noResultCount)
142142 try container. encode ( self . purchaseCount, forKey: . purchaseCount)
143- try container. encode ( self . purchaseRate, forKey: . purchaseRate)
143+ try container. encodeIfPresent ( self . purchaseRate, forKey: . purchaseRate)
144144 try container. encode ( self . searchCount, forKey: . searchCount)
145145 try container. encodeIfPresent ( self . trackedSearchCount, forKey: . trackedSearchCount)
146146 try container. encode ( self . trafficPercentage, forKey: . trafficPercentage)
@@ -177,20 +177,20 @@ extension Variant: Equatable {
177177extension Variant : Hashable {
178178 public func hash( into hasher: inout Hasher ) {
179179 hasher. combine ( self . addToCartCount. hashValue)
180- hasher. combine ( self . addToCartRate. hashValue)
181- hasher. combine ( self . averageClickPosition. hashValue)
180+ hasher. combine ( self . addToCartRate? . hashValue)
181+ hasher. combine ( self . averageClickPosition? . hashValue)
182182 hasher. combine ( self . clickCount. hashValue)
183- hasher. combine ( self . clickThroughRate. hashValue)
183+ hasher. combine ( self . clickThroughRate? . hashValue)
184184 hasher. combine ( self . conversionCount. hashValue)
185- hasher. combine ( self . conversionRate. hashValue)
185+ hasher. combine ( self . conversionRate? . hashValue)
186186 hasher. combine ( self . currencies? . hashValue)
187187 hasher. combine ( self . description. hashValue)
188188 hasher. combine ( self . estimatedSampleSize? . hashValue)
189189 hasher. combine ( self . filterEffects? . hashValue)
190190 hasher. combine ( self . index. hashValue)
191191 hasher. combine ( self . noResultCount. hashValue)
192192 hasher. combine ( self . purchaseCount. hashValue)
193- hasher. combine ( self . purchaseRate. hashValue)
193+ hasher. combine ( self . purchaseRate? . hashValue)
194194 hasher. combine ( self . searchCount. hashValue)
195195 hasher. combine ( self . trackedSearchCount? . hashValue)
196196 hasher. combine ( self . trafficPercentage. hashValue)
0 commit comments