Manos Chorianopoulos

fix unified coupon expiration date

...@@ -196,8 +196,9 @@ import AVFoundation ...@@ -196,8 +196,9 @@ import AVFoundation
196 showBarcodeButtonTopSpace.constant = 0 196 showBarcodeButtonTopSpace.constant = 0
197 // === 197 // ===
198 198
199 - if let earliestExpiration = coupon?._coupons.min(by: { ($0.expiration ?? "") < ($1.expiration ?? "") }) { 199 +// if let earliestExpiration = coupon?._coupons.min(by: { ($0.expiration ?? "") < ($1.expiration ?? "") }) {
200 - expirationLabel.text = "Το κουπόνι ισχύει έως " + (earliestExpiration.expiration ?? "") 200 + if let latestExpiration = coupon?._coupons.max(by: { ($0.expiration ?? "") < ($1.expiration ?? "") }) {
201 + expirationLabel.text = "Το κουπόνι ισχύει έως " + (latestExpiration.expiration ?? "")
201 } else { 202 } else {
202 expirationLabel.text = "" 203 expirationLabel.text = ""
203 } 204 }
......
...@@ -69,8 +69,9 @@ import UIKit ...@@ -69,8 +69,9 @@ import UIKit
69 ) 69 )
70 // + " αξίας " + String(activeCouponsDiscount) + "€" 70 // + " αξίας " + String(activeCouponsDiscount) + "€"
71 71
72 - if let earliestExpiration = activeCoupons.min(by: { ($0.expiration ?? "") < ($1.expiration ?? "") }) { 72 +// if let earliestExpiration = activeCoupons.min(by: { ($0.expiration ?? "") < ($1.expiration ?? "") }) {
73 - expirationLabel.text = "Ισχύει έως " + (earliestExpiration.expiration ?? "") 73 + if let latestExpiration = activeCoupons.max(by: { ($0.expiration ?? "") < ($1.expiration ?? "") }) {
74 + expirationLabel.text = "Ισχύει έως " + (latestExpiration.expiration ?? "")
74 } else { 75 } else {
75 expirationLabel.text = "" 76 expirationLabel.text = ""
76 } 77 }
......