Manos Chorianopoulos

fix AnalysisItemViewCell value

...@@ -70,7 +70,7 @@ extension AnalysisItemViewCell { ...@@ -70,7 +70,7 @@ extension AnalysisItemViewCell {
70 dateLabel.text = item._date 70 dateLabel.text = item._date
71 // titleLabel.text = item._name 71 // titleLabel.text = item._name
72 72
73 - let priceFloat = Float(round(100 * (Float(item._discount) ?? 0.0)) / 100) 73 + let priceFloat = Float(round(100 * (Float(item._final_price) )) / 100)
74 var priceString = "0" 74 var priceString = "0"
75 priceString = String(format: "%.2f", priceFloat).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil) 75 priceString = String(format: "%.2f", priceFloat).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil)
76 priceLabel.text = priceString + "€" 76 priceLabel.text = priceString + "€"
...@@ -106,7 +106,7 @@ extension AnalysisItemViewCell { ...@@ -106,7 +106,7 @@ extension AnalysisItemViewCell {
106 // itemImage.load(link: couponSetData?.img_preview ?? "", placeholder: UIImage(), cache: URLCache()) 106 // itemImage.load(link: couponSetData?.img_preview ?? "", placeholder: UIImage(), cache: URLCache())
107 // titleLabel.text = couponSetData?.name ?? "" 107 // titleLabel.text = couponSetData?.name ?? ""
108 108
109 - let priceFloat = Float(round(100 * (Float(item.discount ?? "") ?? 0.0)) / 100) 109 + let priceFloat = Float(round(100 * (Float(couponSetData?.final_price ?? 0.0) )) / 100)
110 var priceString = "0" 110 var priceString = "0"
111 priceString = String(format: "%.2f", priceFloat).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil) 111 priceString = String(format: "%.2f", priceFloat).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil)
112 priceLabel.text = priceString + "€" 112 priceLabel.text = priceString + "€"
......
...@@ -5327,6 +5327,7 @@ public class swiftApi { ...@@ -5327,6 +5327,7 @@ public class swiftApi {
5327 private var name: String? 5327 private var name: String?
5328 private var receiver_msisdn: String? 5328 private var receiver_msisdn: String?
5329 private var sender_msisdn: String? 5329 private var sender_msisdn: String?
5330 + private var final_price: Float?
5330 5331
5331 public init() { 5332 public init() {
5332 self.couponset_uuid = "" 5333 self.couponset_uuid = ""
...@@ -5338,6 +5339,7 @@ public class swiftApi { ...@@ -5338,6 +5339,7 @@ public class swiftApi {
5338 self.name = "" 5339 self.name = ""
5339 self.receiver_msisdn = "" 5340 self.receiver_msisdn = ""
5340 self.sender_msisdn = "" 5341 self.sender_msisdn = ""
5342 + self.final_price = 0.0
5341 } 5343 }
5342 5344
5343 public init(dictionary: [String: Any]) { 5345 public init(dictionary: [String: Any]) {
...@@ -5348,10 +5350,12 @@ public class swiftApi { ...@@ -5348,10 +5350,12 @@ public class swiftApi {
5348 // self.transaction_metadata = dictionary["transaction_metadata"] as? String? ?? "" 5350 // self.transaction_metadata = dictionary["transaction_metadata"] as? String? ?? ""
5349 5351
5350 self.name = "" 5352 self.name = ""
5353 + self.final_price = 0.0
5351 let couponsetsList = swiftApi().getCouponSetList() 5354 let couponsetsList = swiftApi().getCouponSetList()
5352 for item in couponsetsList { 5355 for item in couponsetsList {
5353 if (item.uuid == self.couponset_uuid) { 5356 if (item.uuid == self.couponset_uuid) {
5354 self.name = item.name ?? "" 5357 self.name = item.name ?? ""
5358 + self.final_price = item.final_price ?? 0.0
5355 break; 5359 break;
5356 } 5360 }
5357 } 5361 }
...@@ -5472,6 +5476,15 @@ public class swiftApi { ...@@ -5472,6 +5476,15 @@ public class swiftApi {
5472 self.sender_msisdn = newValue 5476 self.sender_msisdn = newValue
5473 } 5477 }
5474 } 5478 }
5479 +
5480 + public var _final_price: Float {
5481 + get { // getter
5482 + return self.final_price ?? 0.0
5483 + }
5484 + set(newValue) { //setter
5485 + self.final_price = newValue
5486 + }
5487 + }
5475 } 5488 }
5476 5489
5477 5490
......