diff --git a/data/addressbook.json b/data/addressbook.json deleted file mode 100644 index efbd7cfd15b..00000000000 --- a/data/addressbook.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "categories" : [ { - "categoryName" : "entertainment", - "summary" : "For entertainment" - }, { - "categoryName" : "transportation", - "summary" : "For bus, car, train" - }, { - "categoryName" : "shopping", - "summary" : "" - }, { - "categoryName" : "housing", - "summary" : "" - }, { - "categoryName" : "misc", - "summary" : "Placeholder Description" - }, { - "categoryName" : "food", - "summary" : "" - } ], - "expenses" : [ { - "name" : "Meal at JE", - "amount" : "4.5", - "date" : "2023-04-01", - "category" : { - "categoryName" : "misc", - "summary" : "Placeholder Description" - } - }, { - "name" : "Groceries", - "amount" : "56.3", - "date" : "2023-03-25", - "category" : { - "categoryName" : "misc", - "summary" : "Placeholder Description" - } - }, { - "name" : "Shoes", - "amount" : "75.0", - "date" : "2023-03-20", - "category" : { - "categoryName" : "shopping", - "summary" : "" - } - }, { - "name" : "Movie ticket", - "amount" : "12.99", - "date" : "2023-03-15", - "category" : { - "categoryName" : "entertainment", - "summary" : "For entertainment" - } - } - ], - "budget" : { - "amount" : "0.0" - }, - "recurringGenerators" : [ ] -} diff --git a/data/fastTrack.json b/data/fastTrack.json new file mode 100644 index 00000000000..689ca1349bf --- /dev/null +++ b/data/fastTrack.json @@ -0,0 +1,149 @@ +{ + "categories" : [ { + "categoryName" : "food", + "summary" : "For food" + }, { + "categoryName" : "entertainment", + "summary" : "For entertainment" + }, { + "categoryName" : "transportation", + "summary" : "For bus, car, train" + }, { + "categoryName" : "shopping", + "summary" : "" + }, { + "categoryName" : "housing", + "summary" : "" + }, { + "categoryName" : "groceries", + "summary" : "" + } ], + "expenses" : [ { + "name" : "Meal at JE", + "amount" : "4.5", + "date" : "2023-04-03", + "category" : { + "categoryName" : "food", + "summary" : "For food" + } + }, { + "name" : "Groceries", + "amount" : "56.3", + "date" : "2023-03-25", + "category" : { + "categoryName" : "food", + "summary" : "For food" + } + }, { + "name" : "Shoes", + "amount" : "75.0", + "date" : "2023-03-20", + "category" : { + "categoryName" : "shopping", + "summary" : "" + } + }, { + "name" : "Movie ticket", + "amount" : "12.99", + "date" : "2023-03-15", + "category" : { + "categoryName" : "entertainment", + "summary" : "For entertainment" + } + }, { + "name" : "MRT fare", + "amount" : "45.8", + "date" : "2023-03-10", + "category" : { + "categoryName" : "transportation", + "summary" : "For bus, car, train" + } + }, { + "name" : "milk", + "amount" : "4.5", + "date" : "2000-05-15", + "category" : { + "categoryName" : "groceries", + "summary" : "" + } + }, { + "name" : "milk", + "amount" : "4.5", + "date" : "2000-05-08", + "category" : { + "categoryName" : "groceries", + "summary" : "" + } + }, { + "name" : "milk", + "amount" : "4.5", + "date" : "2000-05-01", + "category" : { + "categoryName" : "groceries", + "summary" : "" + } + }, { + "name" : "milk", + "amount" : "4.5", + "date" : "2000-04-24", + "category" : { + "categoryName" : "groceries", + "summary" : "" + } + }, { + "name" : "milk", + "amount" : "4.5", + "date" : "2000-04-17", + "category" : { + "categoryName" : "groceries", + "summary" : "" + } + }, { + "name" : "milk", + "amount" : "4.5", + "date" : "2000-04-10", + "category" : { + "categoryName" : "groceries", + "summary" : "" + } + }, { + "name" : "milk", + "amount" : "4.5", + "date" : "2000-04-03", + "category" : { + "categoryName" : "groceries", + "summary" : "" + } + }, { + "name" : "milk", + "amount" : "4.5", + "date" : "2000-03-27", + "category" : { + "categoryName" : "groceries", + "summary" : "" + } + }, { + "name" : "milk", + "amount" : "4.5", + "date" : "2000-03-20", + "category" : { + "categoryName" : "groceries", + "summary" : "" + } + } ], + "budget" : { + "amount" : "0.0" + }, + "recurringGenerators" : [ { + "expenseName" : "milk", + "expenseAmount" : "4.5", + "expenseCategory" : { + "categoryName" : "groceries", + "summary" : "" + }, + "nextExpenseDate" : "2000-05-22", + "startDate" : "2000-03-20", + "endDate" : "2000-05-15", + "recurringExpenseType" : "WEEKLY" + } ] +} diff --git a/docs/tutorials/AddRemark.md b/docs/tutorials/AddRemark.md index 9e05a9a7b75..2f4d9eaf411 100644 --- a/docs/tutorials/AddRemark.md +++ b/docs/tutorials/AddRemark.md @@ -295,7 +295,7 @@ While the changes to code may be minimal, the test data will have to be updated
-:exclamation: You must delete AddressBook’s storage file located at `/data/addressbook.json` before running it! Not doing so will cause AddressBook to default to an empty address book! +:exclamation: You must delete AddressBook’s storage file located at `/data/fastTrack.json` before running it! Not doing so will cause AddressBook to default to an empty address book!
diff --git a/src/main/java/seedu/address/MainApp.java b/src/main/java/seedu/address/MainApp.java index 214910b1266..c796f1efbe2 100644 --- a/src/main/java/seedu/address/MainApp.java +++ b/src/main/java/seedu/address/MainApp.java @@ -187,8 +187,9 @@ public void stop() { logger.info("============================ [ Stopping Expense Tracker ] ============================="); try { storage.saveUserPrefs(dataModel.getUserPrefs()); + storage.saveExpenseTracker(dataModel.getExpenseTracker()); } catch (IOException e) { - logger.severe("Failed to save preferences " + StringUtil.getDetails(e)); + logger.severe("Failed to save data " + StringUtil.getDetails(e)); } } } diff --git a/src/main/java/seedu/address/model/UserPrefs.java b/src/main/java/seedu/address/model/UserPrefs.java index a03a67f32cd..97dc9f5687e 100644 --- a/src/main/java/seedu/address/model/UserPrefs.java +++ b/src/main/java/seedu/address/model/UserPrefs.java @@ -14,7 +14,7 @@ public class UserPrefs implements ReadOnlyUserPrefs { private GuiSettings guiSettings = new GuiSettings(); - private Path expenseTrackerFilePath = Paths.get("data" , "addressbook.json"); + private Path expenseTrackerFilePath = Paths.get("data" , "fastTrack.json"); /** * Creates a {@code UserPrefs} with default values. diff --git a/src/main/java/seedu/address/model/expense/RecurringExpenseManager.java b/src/main/java/seedu/address/model/expense/RecurringExpenseManager.java index fa1cee5537d..46444a6083f 100644 --- a/src/main/java/seedu/address/model/expense/RecurringExpenseManager.java +++ b/src/main/java/seedu/address/model/expense/RecurringExpenseManager.java @@ -100,7 +100,11 @@ public RecurringExpenseManager(String expenseName, double amount, public ArrayList getExpenses() { ArrayList expenses = new ArrayList<>(); - while (nextExpenseDate.isBefore(LocalDate.now())) { + LocalDate newEndDate = LocalDate.now(); + if (endDate != null) { + newEndDate = !endDate.isAfter(LocalDate.now()) ? endDate : LocalDate.now(); + } + while (!nextExpenseDate.isAfter(newEndDate)) { expenses.add(new Expense(expenseName, amount, nextExpenseDate, expenseCategory)); nextExpenseDate = recurringExpenseType.getNextExpenseDate(nextExpenseDate); } diff --git a/src/main/java/seedu/address/model/expense/RecurringExpenseType.java b/src/main/java/seedu/address/model/expense/RecurringExpenseType.java index cb66a250f40..72df74e4b96 100644 --- a/src/main/java/seedu/address/model/expense/RecurringExpenseType.java +++ b/src/main/java/seedu/address/model/expense/RecurringExpenseType.java @@ -24,7 +24,7 @@ public LocalDate getNextExpenseDate(LocalDate currentDate) { currentDate = currentDate.plusWeeks(1); break; case DAILY: - currentDate = LocalDate.now().plusDays(1); + currentDate = currentDate.plusDays(1); break; case YEARLY: currentDate = currentDate.plusYears(1); diff --git a/src/main/java/seedu/address/ui/UiManager.java b/src/main/java/seedu/address/ui/UiManager.java index fdf024138bc..a6ed80581fd 100644 --- a/src/main/java/seedu/address/ui/UiManager.java +++ b/src/main/java/seedu/address/ui/UiManager.java @@ -35,9 +35,8 @@ public UiManager(Logic logic) { @Override public void start(Stage primaryStage) { logger.info("Starting UI..."); - //Set the application icon. - primaryStage.getIcons().add(getImage(ICON_APPLICATION)); + //primaryStage.getIcons().add(getImage(ICON_APPLICATION)); try { mainWindow = new MainWindow(primaryStage, logic); diff --git a/src/main/resources/view/MainWindow.fxml b/src/main/resources/view/MainWindow.fxml index 3619b2770d2..8431209fbb6 100644 --- a/src/main/resources/view/MainWindow.fxml +++ b/src/main/resources/view/MainWindow.fxml @@ -14,7 +14,7 @@ - + diff --git a/src/test/data/JsonUserPrefsStorageTest/ExtraValuesUserPref.json b/src/test/data/JsonUserPrefsStorageTest/ExtraValuesUserPref.json index 1037548a9cd..b68e70c3537 100644 --- a/src/test/data/JsonUserPrefsStorageTest/ExtraValuesUserPref.json +++ b/src/test/data/JsonUserPrefsStorageTest/ExtraValuesUserPref.json @@ -9,5 +9,5 @@ "z" : 99 } }, - "addressBookFilePath" : "addressbook.json" + "addressBookFilePath" : "fastTrack.json" } diff --git a/src/test/data/JsonUserPrefsStorageTest/TypicalUserPref.json b/src/test/data/JsonUserPrefsStorageTest/TypicalUserPref.json index b819bed900a..8acdcb62af1 100644 --- a/src/test/data/JsonUserPrefsStorageTest/TypicalUserPref.json +++ b/src/test/data/JsonUserPrefsStorageTest/TypicalUserPref.json @@ -7,5 +7,5 @@ "y" : 100 } }, - "addressBookFilePath" : "addressbook.json" + "addressBookFilePath" : "fastTrack.json" } diff --git a/src/test/java/seedu/address/logic/LogicManagerTest.java b/src/test/java/seedu/address/logic/LogicManagerTest.java index 666af24b93f..a88007f06ec 100644 --- a/src/test/java/seedu/address/logic/LogicManagerTest.java +++ b/src/test/java/seedu/address/logic/LogicManagerTest.java @@ -40,7 +40,7 @@ public class LogicManagerTest { @BeforeEach public void setUp() { JsonExpenseTrackerStorage addressBookStorage = new JsonExpenseTrackerStorage( - temporaryFolder.resolve("addressBook.json")); + temporaryFolder.resolve("fastTrack.json")); JsonUserPrefsStorage userPrefsStorage = new JsonUserPrefsStorage(temporaryFolder.resolve("userPrefs.json")); StorageManager storage = new StorageManager(addressBookStorage, userPrefsStorage); logic = new LogicManager(dataModel, storage); @@ -70,7 +70,7 @@ public void execute_validCommand_success() throws Exception { public void execute_storageThrowsIoException_throwsCommandException() { // Setup LogicManager with JsonAddressBookIoExceptionThrowingStub JsonExpenseTrackerStorage addressBookStorage = new JsonAddressBookIoExceptionThrowingStub( - temporaryFolder.resolve("ioExceptionAddressBook.json")); + temporaryFolder.resolve("ioExceptionFastTrack.json")); JsonUserPrefsStorage userPrefsStorage = new JsonUserPrefsStorage( temporaryFolder.resolve("ioExceptionUserPrefs.json")); StorageManager storage = new StorageManager(addressBookStorage, userPrefsStorage); diff --git a/src/test/java/seedu/address/storage/JsonUserPrefsStorageTest.java b/src/test/java/seedu/address/storage/JsonUserPrefsStorageTest.java index cfb050051f3..56b8795cd4e 100644 --- a/src/test/java/seedu/address/storage/JsonUserPrefsStorageTest.java +++ b/src/test/java/seedu/address/storage/JsonUserPrefsStorageTest.java @@ -73,7 +73,7 @@ public void readUserPrefs_extraValuesInFile_extraValuesIgnored() throws DataConv private UserPrefs getTypicalUserPrefs() { UserPrefs userPrefs = new UserPrefs(); userPrefs.setGuiSettings(new GuiSettings(1000, 500, 300, 100)); - userPrefs.setExpenseTrackerFilePath(Paths.get("addressbook.json")); + userPrefs.setExpenseTrackerFilePath(Paths.get("FastTrack.json")); return userPrefs; }