Modified files

- Deleted UpdateQuality and UpdateSellin in GildedRose
- Modified BackStagePasses
This commit is contained in:
Adefolarin Adeniji 2021-08-28 11:33:46 +01:00
parent 6ab52bfc46
commit a15e48a03e
2 changed files with 9 additions and 82 deletions

View File

@ -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;
}
}
}
}
}
}
}

View File

@ -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;
}
}