Showing
1 changed file
with
10 additions
and
3 deletions
... | @@ -94,9 +94,9 @@ import UIKit | ... | @@ -94,9 +94,9 @@ import UIKit |
94 | couponEarnView.layer.shadowOpacity = 1.0 | 94 | couponEarnView.layer.shadowOpacity = 1.0 |
95 | couponEarnView.layer.shadowRadius = 3.0 | 95 | couponEarnView.layer.shadowRadius = 3.0 |
96 | 96 | ||
97 | - // TODO: dynamic | 97 | + |
98 | - couponEarnLabel.text = "Μέχρι τώρα έχεις κερδίσει 20,00€ σε προσφορές από 3 κουπόνια!" | 98 | + couponEarnLabel.text = "" |
99 | - couponEarnAmountLabel.text = "20,00€" | 99 | + couponEarnAmountLabel.text = "" |
100 | 100 | ||
101 | activeCodeView.layer.cornerRadius = 5.0 | 101 | activeCodeView.layer.cornerRadius = 5.0 |
102 | activeCodeView.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.16).cgColor | 102 | activeCodeView.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.16).cgColor |
... | @@ -122,6 +122,13 @@ import UIKit | ... | @@ -122,6 +122,13 @@ import UIKit |
122 | 122 | ||
123 | DispatchQueue.main.async { | 123 | DispatchQueue.main.async { |
124 | self.tableView.reloadData() | 124 | self.tableView.reloadData() |
125 | + | ||
126 | + var totalCouponDiscount = self.coupons.reduce(0) { $0 + (Float($1.discount ?? "") ?? 0) } | ||
127 | + totalCouponDiscount = Float(round(100 * totalCouponDiscount) / 100) | ||
128 | + let totalCouponDiscountString = String(format: "%.2f", totalCouponDiscount).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil) | ||
129 | + | ||
130 | + self.couponEarnLabel.text = "Μέχρι τώρα έχεις κερδίσει " + totalCouponDiscountString + "€ σε προσφορές από " + String(activeCouponData.count) + " κουπόνια!" | ||
131 | + self.couponEarnAmountLabel.text = totalCouponDiscountString + "€" | ||
125 | } | 132 | } |
126 | } else { | 133 | } else { |
127 | self.coupons = [] | 134 | self.coupons = [] | ... | ... |
-
Please register or login to post a comment