GildedRose-Refactoring-Kata/go/gildedrose/gildedrose.go
Miguel Ignacio Cabrera San Gil f6fe61daac feat: update go boilerplate
2022-04-26 16:27:42 +01:00

59 lines
1.4 KiB
Go

package gildedrose
type Item struct {
Name string
SellIn, Quality int
}
func UpdateQuality(items []*Item) {
for i := 0; i < len(items); 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
}
}
}
}
}