Set the advertise flag if at least one supplier wants it to be set
This commit is contained in:
		@ -29,6 +29,12 @@ public class UpdateOffersAction {
 | 
			
		||||
 | 
			
		||||
    public List<ArticleOffer> finish() {
 | 
			
		||||
        HashMap<ArticleIdentifier, ArticleOffer> availableOffers = mapOffers();
 | 
			
		||||
 | 
			
		||||
        // Reset all advertise-flags first. They are set again below.
 | 
			
		||||
        for (ArticleOffer offer : availableOffers.values()) {
 | 
			
		||||
            offer.shouldBeAdvertised = false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        for (Entry<ArticleIdentifier, Offer> cheapestOffer : cheapestOffer.entrySet()) {
 | 
			
		||||
            String manufacturer = cheapestOffer.getKey().manufacturer;
 | 
			
		||||
            String articleNumber = cheapestOffer.getKey().articleNumber;
 | 
			
		||||
@ -42,7 +48,11 @@ public class UpdateOffersAction {
 | 
			
		||||
            Article currentOfferedArticle = cheapestOffer.getValue().apiSupplier.findArticle(manufacturer,
 | 
			
		||||
                    articleNumber);
 | 
			
		||||
            currentOffer.vatPercent = currentOfferedArticle.vatPercent;
 | 
			
		||||
            currentOffer.shouldBeAdvertised = currentOfferedArticle.shouldBeAdvertised;
 | 
			
		||||
 | 
			
		||||
            // Set advertise-flag if any supplier wants it to be set
 | 
			
		||||
            if (currentOfferedArticle.shouldBeAdvertised) {
 | 
			
		||||
                currentOffer.shouldBeAdvertised = true;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return offers;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user