Manos Chorianopoulos

fix AnalysisItemViewCell value

......@@ -70,7 +70,7 @@ extension AnalysisItemViewCell {
dateLabel.text = item._date
// titleLabel.text = item._name
let priceFloat = Float(round(100 * (Float(item._discount) ?? 0.0)) / 100)
let priceFloat = Float(round(100 * (Float(item._final_price) )) / 100)
var priceString = "0"
priceString = String(format: "%.2f", priceFloat).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil)
priceLabel.text = priceString + "€"
......@@ -106,7 +106,7 @@ extension AnalysisItemViewCell {
// itemImage.load(link: couponSetData?.img_preview ?? "", placeholder: UIImage(), cache: URLCache())
// titleLabel.text = couponSetData?.name ?? ""
let priceFloat = Float(round(100 * (Float(item.discount ?? "") ?? 0.0)) / 100)
let priceFloat = Float(round(100 * (Float(couponSetData?.final_price ?? 0.0) )) / 100)
var priceString = "0"
priceString = String(format: "%.2f", priceFloat).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil)
priceLabel.text = priceString + "€"
......
......@@ -5327,6 +5327,7 @@ public class swiftApi {
private var name: String?
private var receiver_msisdn: String?
private var sender_msisdn: String?
private var final_price: Float?
public init() {
self.couponset_uuid = ""
......@@ -5338,6 +5339,7 @@ public class swiftApi {
self.name = ""
self.receiver_msisdn = ""
self.sender_msisdn = ""
self.final_price = 0.0
}
public init(dictionary: [String: Any]) {
......@@ -5348,10 +5350,12 @@ public class swiftApi {
// self.transaction_metadata = dictionary["transaction_metadata"] as? String? ?? ""
self.name = ""
self.final_price = 0.0
let couponsetsList = swiftApi().getCouponSetList()
for item in couponsetsList {
if (item.uuid == self.couponset_uuid) {
self.name = item.name ?? ""
self.final_price = item.final_price ?? 0.0
break;
}
}
......@@ -5472,6 +5476,15 @@ public class swiftApi {
self.sender_msisdn = newValue
}
}
public var _final_price: Float {
get { // getter
return self.final_price ?? 0.0
}
set(newValue) { //setter
self.final_price = newValue
}
}
}
......