Panagiotis Triantafyllou

sm deals history fixes

...@@ -204,27 +204,22 @@ public class LoyaltyHistoryActivity extends Activity implements View.OnClickList ...@@ -204,27 +204,22 @@ public class LoyaltyHistoryActivity extends Activity implements View.OnClickList
204 countValue = 0.0f; 204 countValue = 0.0f;
205 205
206 if (WarplyManagerHelper.getCouponRedeemedList().size() > 0) { 206 if (WarplyManagerHelper.getCouponRedeemedList().size() > 0) {
207 - if (WarplyManagerHelper.getCouponsetsDeals().size() > 0) { 207 + for (Coupon cou : WarplyManagerHelper.getCouponRedeemedList()) {
208 - for (Couponset couset : WarplyManagerHelper.getCouponsetsDeals()) { 208 + if (cou.getCouponsetDetails().getCouponsetType().equals("supermarket")) {
209 - for (Coupon cou : WarplyManagerHelper.getCouponRedeemedList()) { 209 + countValue += Float.parseFloat(cou.getDiscount());
210 - if (cou.getCouponsetUuid().equals(couset.getUuid())) { 210 + cou.setDescription(cou.getCouponsetDetails().getShortDescription());
211 - countValue += Float.parseFloat(cou.getDiscount()); 211 + cou.setImage(cou.getCouponsetDetails().getImgPreview());
212 - cou.setDescription(couset.getShortDescription()); 212 + cou.setName(cou.getCouponsetDetails().getName());
213 - cou.setImage(couset.getImgPreview()); 213 + cou.setMerchantUuid(cou.getCouponsetDetails().getMerchantUuid());
214 - cou.setName(couset.getName()); 214 + cou.setInnerText(cou.getCouponsetDetails().getInnerText());
215 - cou.setMerchantUuid(couset.getMerchantUuid()); 215 + cou.setDiscount_type(cou.getCouponsetDetails().getDiscount_type());
216 - cou.setInnerText(couset.getInnerText()); 216 + cou.setFinal_price(cou.getCouponsetDetails().getFinal_price());
217 - cou.setDiscount_type(couset.getDiscount_type());
218 - cou.setFinal_price(couset.getFinal_price());
219 - break;
220 - }
221 - }
222 } 217 }
223 } 218 }
224 } 219 }
225 220
226 mFavValue += countValue; 221 mFavValue += countValue;
227 - String badgeValue = String.format(Locale.GERMAN,"%.02f", countValue); 222 + String badgeValue = String.format(Locale.GERMAN, "%.02f", countValue);
228 mTvMarketValue.setText(String.format(getString(R.string.cos_value), badgeValue)); 223 mTvMarketValue.setText(String.format(getString(R.string.cos_value), badgeValue));
229 if (String.valueOf(countValue).length() >= 3) { 224 if (String.valueOf(countValue).length() >= 3) {
230 mTvMarketValue.setTextSize(12); 225 mTvMarketValue.setTextSize(12);
...@@ -237,7 +232,7 @@ public class LoyaltyHistoryActivity extends Activity implements View.OnClickList ...@@ -237,7 +232,7 @@ public class LoyaltyHistoryActivity extends Activity implements View.OnClickList
237 sBuilderThird.setSpan(typefaceBoldSpanThird, 24, 24 + badgeValue.length() + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); 232 sBuilderThird.setSpan(typefaceBoldSpanThird, 24, 24 + badgeValue.length() + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
238 mTvMarketAll.setText(sBuilderThird, TextView.BufferType.SPANNABLE); 233 mTvMarketAll.setText(sBuilderThird, TextView.BufferType.SPANNABLE);
239 } else { 234 } else {
240 - String badgeValue = String.format(Locale.GERMAN,"%.02f", 0.0f); 235 + String badgeValue = String.format(Locale.GERMAN, "%.02f", 0.0f);
241 mTvMarketValue.setText(String.format(getString(R.string.cos_value), badgeValue)); 236 mTvMarketValue.setText(String.format(getString(R.string.cos_value), badgeValue));
242 SpannableStringBuilder sBuilderThird = new SpannableStringBuilder(); 237 SpannableStringBuilder sBuilderThird = new SpannableStringBuilder();
243 sBuilderThird.append(String.format(getString(R.string.cos_supermarket_win), badgeValue)); 238 sBuilderThird.append(String.format(getString(R.string.cos_supermarket_win), badgeValue));
...@@ -249,7 +244,7 @@ public class LoyaltyHistoryActivity extends Activity implements View.OnClickList ...@@ -249,7 +244,7 @@ public class LoyaltyHistoryActivity extends Activity implements View.OnClickList
249 244
250 /** Third Banner */ 245 /** Third Banner */
251 if (WarplyManagerHelper.getLoyaltyBadge() != null && (WarplyManagerHelper.getLoyaltyBadge().getCouponCount() > 0 || WarplyManagerHelper.getLoyaltyBadge().getCouponCount() == 0)) { 246 if (WarplyManagerHelper.getLoyaltyBadge() != null && (WarplyManagerHelper.getLoyaltyBadge().getCouponCount() > 0 || WarplyManagerHelper.getLoyaltyBadge().getCouponCount() == 0)) {
252 - String badgeValue = String.format(Locale.GERMAN,"%.02f", WarplyManagerHelper.getLoyaltyBadge().getValue()); 247 + String badgeValue = String.format(Locale.GERMAN, "%.02f", WarplyManagerHelper.getLoyaltyBadge().getValue());
253 mTvGiftsValue.setText(String.format(getString(R.string.cos_value), badgeValue)); 248 mTvGiftsValue.setText(String.format(getString(R.string.cos_value), badgeValue));
254 if (String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getValue()).length() >= 3) { 249 if (String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getValue()).length() >= 3) {
255 mTvGiftsValue.setTextSize(12); 250 mTvGiftsValue.setTextSize(12);
...@@ -266,7 +261,7 @@ public class LoyaltyHistoryActivity extends Activity implements View.OnClickList ...@@ -266,7 +261,7 @@ public class LoyaltyHistoryActivity extends Activity implements View.OnClickList
266 /** Third Banner */ 261 /** Third Banner */
267 262
268 /** Sum Banner */ 263 /** Sum Banner */
269 - String allValue = String.format(Locale.GERMAN,"%.02f", mFavValue); 264 + String allValue = String.format(Locale.GERMAN, "%.02f", mFavValue);
270 mTvFavValue.setText(String.format(getString(R.string.cos_value), allValue)); 265 mTvFavValue.setText(String.format(getString(R.string.cos_value), allValue));
271 /** Sum Banner */ 266 /** Sum Banner */
272 } 267 }
......
...@@ -104,15 +104,10 @@ public class LoyaltyMarketAnalysisActivity extends Activity implements View.OnCl ...@@ -104,15 +104,10 @@ public class LoyaltyMarketAnalysisActivity extends Activity implements View.OnCl
104 // } 104 // }
105 105
106 if (WarplyManagerHelper.getCouponRedeemedList().size() > 0) { 106 if (WarplyManagerHelper.getCouponRedeemedList().size() > 0) {
107 - if (WarplyManagerHelper.getCouponsetsDeals().size() > 0) { 107 + for (Coupon cou : WarplyManagerHelper.getCouponRedeemedList()) {
108 - for (Couponset couset : WarplyManagerHelper.getCouponsetsDeals()) { 108 + if (cou.getCouponsetDetails().getCouponsetType().equals("supermarket")) {
109 - for (Coupon cou : WarplyManagerHelper.getCouponRedeemedList()) { 109 + countValue += Float.valueOf(cou.getDiscount());
110 - if (cou.getCouponsetUuid().equals(couset.getUuid())) { 110 + mExpiredMarketCoupons.add(cou);
111 - countValue += Float.valueOf(cou.getDiscount());
112 - mExpiredMarketCoupons.add(cou);
113 - break;
114 - }
115 - }
116 } 111 }
117 } 112 }
118 } 113 }
......