diff --git a/csharpcore/GildedRose/GildedRose.cs b/csharpcore/GildedRose/GildedRose.cs index ed7dc428..b97a20cc 100644 --- a/csharpcore/GildedRose/GildedRose.cs +++ b/csharpcore/GildedRose/GildedRose.cs @@ -9,81 +9,5 @@ namespace GildedRoseKata { this.Items = Items; } - - public void UpdateQuality() - { - for (var i = 0; i < Items.Count; i++) - { - if (Items[i].Name != "Aged Brie" && Items[i].Name != "Backstage passes to a TAFKAL80ETC concert") - { - if (Items[i].Quality > 0) - { - if (Items[i].Name != "Sulfuras, Hand of Ragnaros") - { - Items[i].Quality = Items[i].Quality - 1; - } - } - } - else - { - if (Items[i].Quality < 50) - { - Items[i].Quality = Items[i].Quality + 1; - - if (Items[i].Name == "Backstage passes to a TAFKAL80ETC concert") - { - if (Items[i].SellIn < 11) - { - if (Items[i].Quality < 50) - { - Items[i].Quality = Items[i].Quality + 1; - } - } - - if (Items[i].SellIn < 6) - { - if (Items[i].Quality < 50) - { - Items[i].Quality = Items[i].Quality + 1; - } - } - } - } - } - - if (Items[i].Name != "Sulfuras, Hand of Ragnaros") - { - Items[i].SellIn = Items[i].SellIn - 1; - } - - if (Items[i].SellIn < 0) - { - if (Items[i].Name != "Aged Brie") - { - if (Items[i].Name != "Backstage passes to a TAFKAL80ETC concert") - { - if (Items[i].Quality > 0) - { - if (Items[i].Name != "Sulfuras, Hand of Ragnaros") - { - Items[i].Quality = Items[i].Quality - 1; - } - } - } - else - { - Items[i].Quality = Items[i].Quality - Items[i].Quality; - } - } - else - { - if (Items[i].Quality < 50) - { - Items[i].Quality = Items[i].Quality + 1; - } - } - } - } - } } } diff --git a/csharpcore/GildedRose/Models/BackStagePasses.cs b/csharpcore/GildedRose/Models/BackStagePasses.cs index 1e415177..6c15dc8d 100644 --- a/csharpcore/GildedRose/Models/BackStagePasses.cs +++ b/csharpcore/GildedRose/Models/BackStagePasses.cs @@ -12,18 +12,21 @@ namespace GildedRose.Models if (this.SellDaysGone > this.SellIn) { this.Quality = 0; - } - - if ((this.SellIn - this.SellDaysGone) <= 5) - { - if (this.Quality < 51) - this.Quality += 3; + return; } if ((this.SellIn - this.SellDaysGone) <= 10) { if (this.Quality < 51) this.Quality += 2; + return; + } + + if ((this.SellIn - this.SellDaysGone) <= 5) + { + if (this.Quality < 51) + this.Quality += 3; + return; } }