From c7eafcaeec329b426dedabf6f5b9e19017cbde1c Mon Sep 17 00:00:00 2001 From: Sarah Ashri Date: Wed, 13 Mar 2024 14:12:21 +1000 Subject: [PATCH] separate processing of different types --- csharpcore/GildedRose/GildedRose.cs | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/csharpcore/GildedRose/GildedRose.cs b/csharpcore/GildedRose/GildedRose.cs index 74c37f1b..528cbe67 100644 --- a/csharpcore/GildedRose/GildedRose.cs +++ b/csharpcore/GildedRose/GildedRose.cs @@ -51,22 +51,25 @@ public class GildedRose { DecreaseQuality(item, 1); } - - if(IsBetterWithAgeItem(item) || IsBackstagePassesItem(item)) + + if (IsBetterWithAgeItem(item)) { IncreaseQuality(item, 1); + } - if (IsBackstagePassesItem(item)) + if(IsBackstagePassesItem(item)) + { + if (item.SellIn > 10) { - if (item.SellIn < 11) - { - IncreaseQuality(item, 1); - } - - if (item.SellIn < 6) - { - IncreaseQuality(item, 1); - } + IncreaseQuality(item, 1); + } + else if (item.SellIn > 5) + { + IncreaseQuality(item, 2); + } + else + { + IncreaseQuality(item, 3); } }