mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-10-16 19:05:05 +00:00
Add elm folder
This commit is contained in:
1 parent
1cd3ba5e2c
commit
070169c89a
59 files changed
+6660
No files matched your search
@@ -0,0 +1,53 @@
|
||||
module GildedRose exposing (Item, update_quality)
|
||||
|
||||
|
||||
type alias Item =
|
||||
{ name : String
|
||||
, sell_by : Int
|
||||
, quality : Int
|
||||
}
|
||||
|
||||
|
||||
update_quality : List Item -> List Item
|
||||
update_quality items =
|
||||
List.map
|
||||
(\item ->
|
||||
if item.name == "Aged Brie" || item.name == "Backstage passes to a TAFKAL80ETC concert" then
|
||||
if item.quality < 50 then
|
||||
if item.name == "Backstage passes to a TAFKAL80ETC concert" then
|
||||
if item.sell_by < 0 then
|
||||
{ item | sell_by = item.sell_by - 1, quality = 0 }
|
||||
|
||||
else if item.sell_by < 6 then
|
||||
{ item | sell_by = item.sell_by - 1, quality = item.quality + 3 }
|
||||
|
||||
else if item.sell_by < 11 then
|
||||
{ item | sell_by = item.sell_by - 1, quality = item.quality + 2 }
|
||||
|
||||
else
|
||||
{ item | sell_by = item.sell_by - 1, quality = item.quality + 1 }
|
||||
|
||||
else
|
||||
{ item | sell_by = item.sell_by - 1, quality = item.quality + 1 }
|
||||
|
||||
else
|
||||
{ item | sell_by = item.sell_by }
|
||||
|
||||
else if item.name /= "Aged Brie" && item.name /= "Sulfuras, Hand of Ragnaros" then
|
||||
if item.sell_by < 0 && item.quality > 0 then
|
||||
if item.quality >= 2 then
|
||||
{ item | sell_by = item.sell_by - 1, quality = item.quality - 2 }
|
||||
|
||||
else
|
||||
{ item | sell_by = item.sell_by - 1, quality = 0 }
|
||||
|
||||
else if item.quality >= 1 then
|
||||
{ item | sell_by = item.sell_by - 1, quality = item.quality - 1 }
|
||||
|
||||
else
|
||||
{ item | sell_by = item.sell_by - 1, quality = 0 }
|
||||
|
||||
else
|
||||
item
|
||||
)
|
||||
items
|
||||
@@ -0,0 +1,7 @@
|
||||
module Main exposing (main)
|
||||
|
||||
import Html exposing (..)
|
||||
|
||||
|
||||
main =
|
||||
text "Gilded Rose"
|
||||
Reference in new issue
Block a user