mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-10-20 21:05:05 +00:00
use foreach for extra indentation
This commit is contained in:
1 parent
9abe955027
commit
9a2736d267
3 files changed
+47
-42
No files matched your search
+45
-40
@@ -1,49 +1,54 @@
|
||||
def update_quality:
|
||||
if .name != "Aged Brie" and .name != "Backstage passes to a TAFKAL80ETC concert" then
|
||||
if .quality > 0 then
|
||||
if .name != "Sulfuras, Hand of Ragnaros" then
|
||||
.quality = .quality - 1
|
||||
else . end
|
||||
else . end
|
||||
else
|
||||
if .quality < 50 then
|
||||
.quality = .quality + 1
|
||||
|
|
||||
if .name == "Backstage passes to a TAFKAL80ETC concert" then
|
||||
if .sell_in < 11 then
|
||||
if .quality < 50 then
|
||||
.quality = .quality + 1
|
||||
else . end
|
||||
else . end
|
||||
|
|
||||
if .sell_in < 6 then
|
||||
if .quality < 50 then
|
||||
.quality = .quality + 1
|
||||
else . end
|
||||
else . end
|
||||
else . end
|
||||
else . end
|
||||
end
|
||||
|
|
||||
if .name != "Sulfuras, Hand of Ragnaros" then
|
||||
.sell_in = .sell_in - 1
|
||||
else . end
|
||||
|
|
||||
if .sell_in < 0 then
|
||||
if .name != "Aged Brie" then
|
||||
if .name != "Backstage passes to a TAFKAL80ETC concert" then
|
||||
[
|
||||
foreach .[] as $item (
|
||||
null;
|
||||
$item |
|
||||
if .name != "Aged Brie" and .name != "Backstage passes to a TAFKAL80ETC concert" then
|
||||
if .quality > 0 then
|
||||
if .name != "Sulfuras, Hand of Ragnaros" then
|
||||
.quality = .quality - 1
|
||||
else . end
|
||||
else . end
|
||||
else
|
||||
.quality = .quality - .quality
|
||||
if .quality < 50 then
|
||||
.quality = .quality + 1
|
||||
|
|
||||
if .name == "Backstage passes to a TAFKAL80ETC concert" then
|
||||
if .sell_in < 11 then
|
||||
if .quality < 50 then
|
||||
.quality = .quality + 1
|
||||
else . end
|
||||
else . end
|
||||
|
|
||||
if .sell_in < 6 then
|
||||
if .quality < 50 then
|
||||
.quality = .quality + 1
|
||||
else . end
|
||||
else . end
|
||||
else . end
|
||||
else . end
|
||||
end
|
||||
else
|
||||
if .quality < 50 then
|
||||
.quality = .quality + 1
|
||||
|
|
||||
if .name != "Sulfuras, Hand of Ragnaros" then
|
||||
.sell_in = .sell_in - 1
|
||||
else . end
|
||||
end
|
||||
else . end
|
||||
;
|
||||
|
|
||||
if .sell_in < 0 then
|
||||
if .name != "Aged Brie" then
|
||||
if .name != "Backstage passes to a TAFKAL80ETC concert" then
|
||||
if .quality > 0 then
|
||||
if .name != "Sulfuras, Hand of Ragnaros" then
|
||||
.quality = .quality - 1
|
||||
else . end
|
||||
else . end
|
||||
else
|
||||
.quality = .quality - .quality
|
||||
end
|
||||
else
|
||||
if .quality < 50 then
|
||||
.quality = .quality + 1
|
||||
else . end
|
||||
end
|
||||
else . end
|
||||
)
|
||||
];
|
||||
Reference in new issue
Block a user