mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 22:41:30 +00:00
added MAX_ITEM_QUALITY in constants file and referred it
This commit is contained in:
parent
e44c0a1d18
commit
f6a3a6d718
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
A const to hold the names of the items
|
A const to hold the names of the items
|
||||||
*/
|
*/
|
||||||
@ -8,4 +7,6 @@ const ItemNames = {
|
|||||||
SULFURAS: "Sulfuras, Hand of Ragnaros",
|
SULFURAS: "Sulfuras, Hand of Ragnaros",
|
||||||
};
|
};
|
||||||
|
|
||||||
export { ItemNames };
|
const MAX_ITEM_QUALITY = 50;
|
||||||
|
|
||||||
|
export { ItemNames, MAX_ITEM_QUALITY };
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import { ItemNames } from "./constants";
|
import { ItemNames, MAX_ITEM_QUALITY } from "./constants";
|
||||||
|
|
||||||
|
|
||||||
export class Item {
|
export class Item {
|
||||||
name: string;
|
name: string;
|
||||||
@ -32,16 +31,16 @@ export class GildedRose {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (item.quality < 50) {
|
if (item.quality < MAX_ITEM_QUALITY) {
|
||||||
item.quality = item.quality + 1;
|
item.quality = item.quality + 1;
|
||||||
if (item.name == ItemNames.BACKSTAGE_PASSES) {
|
if (item.name == ItemNames.BACKSTAGE_PASSES) {
|
||||||
if (item.sellIn < 11) {
|
if (item.sellIn < 11) {
|
||||||
if (item.quality < 50) {
|
if (item.quality < MAX_ITEM_QUALITY) {
|
||||||
item.quality = item.quality + 1;
|
item.quality = item.quality + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (item.sellIn < 6) {
|
if (item.sellIn < 6) {
|
||||||
if (item.quality < 50) {
|
if (item.quality < MAX_ITEM_QUALITY) {
|
||||||
item.quality = item.quality + 1;
|
item.quality = item.quality + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -63,7 +62,7 @@ export class GildedRose {
|
|||||||
item.quality = item.quality - item.quality;
|
item.quality = item.quality - item.quality;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (item.quality < 50) {
|
if (item.quality < MAX_ITEM_QUALITY) {
|
||||||
item.quality = item.quality + 1;
|
item.quality = item.quality + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user