Subversion Repositories SmartDukaan

Rev

Rev 33896 | Rev 33899 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 33896 Rev 33897
Line 830... Line 830...
830
            LOGGER.info("partnerType if- {}",partnerType);
830
            LOGGER.info("partnerType if- {}",partnerType);
831
            sellingPrice = 0.0;
831
            sellingPrice = 0.0;
832
        }
832
        }
833
        for (Double price : PRICE_RANGE) {
833
        for (Double price : PRICE_RANGE) {
834
            if (sellingPrice >= price) {
834
            if (sellingPrice >= price) {
-
 
835
                // If we find a matching price range, add gifts and exit the loop
835
                int divisor = PRICE_RANGE.size() - index;
836
                int divisor = PRICE_RANGE.size() - index;
836
                for (ScratchedGift gift : GIFT_SERIES.get(price)) {
837
                for (ScratchedGift gift : GIFT_SERIES.get(price)) {
837
                    int remainingQty = GIFT_QUANTITIES.get(gift) - soldGiftContMap.getOrDefault(gift, 0l).intValue();
838
                    int remainingQty = GIFT_QUANTITIES.get(gift) - soldGiftContMap.getOrDefault(gift, 0L).intValue();
838
                    if (remainingQty == 0) {
839
                    if (remainingQty > 0) {
-
 
840
                        int weight = (remainingQty > divisor) ? remainingQty / divisor : remainingQty;
839
                        continue;
841
                        randomCollection.add(weight, gift);
840
                    }
842
                    }
841
                    if (remainingQty > divisor) {
-
 
842
                        randomCollection.add(remainingQty / divisor, gift);
-
 
843
                    } else {
-
 
844
                        randomCollection.add(remainingQty, gift);
-
 
845
                    }
-
 
846
 
-
 
847
                }
843
                }
848
                index++;
844
                break; // Exit loop once matching price range is processed
849
            }
845
            }
-
 
846
            index++;
850
        }
847
        }
-
 
848
        LOGGER.info("randomCollectionSize {}, partnerType {}, price {},", randomCollection.size(), partnerType, sellingPrice);
851
        return randomCollection;
849
        return randomCollection;
852
    }
850
    }
853
 
851
 
854
    /*static {
852
    /*static {
855
        RandomCollection<ScratchedGift> map1 = new RandomCollection<ScratchedGift>().
853
        RandomCollection<ScratchedGift> map1 = new RandomCollection<ScratchedGift>().