Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task 386 Remove this References #392

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -154,7 +154,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 @@ -177,7 +177,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 @@ -214,7 +214,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
Loading