Skip to content

Commit

Permalink
Merge pull request #392 from ziyi105/386-remove-this-references
Browse files Browse the repository at this point in the history
Task 386 Remove this References
  • Loading branch information
DextheChik3n authored Nov 13, 2023
2 parents ad1f273 + e27a795 commit 12e639b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions src/main/java/seedu/cafectrl/command/EditPriceCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ public class EditPriceCommand extends Command {
protected Menu menu;
protected Ui ui;
private final int menuID;
private final float newPrice;
private final float newDishPrice;

public EditPriceCommand(int menuID, float newPrice, Menu menu, Ui ui) {
public EditPriceCommand(int menuID, float newDishPrice, Menu menu, Ui ui) {
this.menuID = menuID;
this.newPrice = newPrice;
this.newDishPrice = newDishPrice;
this.menu = menu;
this.ui = ui;
}
Expand All @@ -37,13 +37,13 @@ public EditPriceCommand(int menuID, float newPrice, Menu menu, Ui ui) {
*/
public void execute() {
logger.info("Executing EditPriceCommand...");
Dish dish = menu.getDishFromId(this.menuID - Ui.OFFSET_LIST_INDEX);
Dish dish = menu.getDishFromId(menuID - Ui.OFFSET_LIST_INDEX);

// Checks for original price
if (dish.comparePrice(this.newPrice) == 0) {
this.ui.showToUser(ErrorMessages.EDIT_SAME_PRICE);
if (dish.comparePrice(newDishPrice) == 0) {
ui.showToUser(ErrorMessages.EDIT_SAME_PRICE);
} else {
dish.setPrice(this.newPrice);
dish.setPrice(newDishPrice);
ui.showEditPriceMessage(dish.toString());
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/seedu/cafectrl/storage/Storage.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ private void saveMenu(Menu menu) throws IOException {
*/
public Pantry loadPantryStock() {
try {
ArrayList<String> encodedPantryStock = this.fileManager.readTextFile(FilePath.PANTRY_STOCK_FILE_PATH);
ArrayList<String> encodedPantryStock = fileManager.readTextFile(FilePath.PANTRY_STOCK_FILE_PATH);
if (!isFileEmpty(encodedPantryStock) && isFileCorrupted(encodedPantryStock) && isHashingEnabled) {
isPantryStockTampered = true;
logger.log(Level.INFO, "Tampered Pantry Stock file");
Expand All @@ -178,7 +178,7 @@ public Pantry loadPantryStock() {
* @throws IOException if the file is not found in the specified file path
*/
private void savePantryStock(Pantry pantry) throws IOException {
this.fileManager.overwriteFile(FilePath.PANTRY_STOCK_FILE_PATH, Encoder.encodePantryStock(pantry));
fileManager.overwriteFile(FilePath.PANTRY_STOCK_FILE_PATH, Encoder.encodePantryStock(pantry));
}

//@@author NaychiMin
Expand Down Expand Up @@ -215,7 +215,7 @@ public Sales loadOrderList(Menu menu) {
*/
private void saveOrderList(Sales sales) throws IOException {
logger.info("Saving orders...");
this.fileManager.overwriteFile(FilePath.ORDERS_FILE_PATH, Encoder.encodeSales(sales));
fileManager.overwriteFile(FilePath.ORDERS_FILE_PATH, Encoder.encodeSales(sales));
}

//@@author ziyi105
Expand Down

0 comments on commit 12e639b

Please sign in to comment.