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

Fix invalid handling of data file upon application launch and minor c… #254

Merged
merged 1 commit into from
Nov 10, 2023
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
2 changes: 1 addition & 1 deletion docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ UNOFAS data are saved in the hard disk automatically after any command that chan
UNOFAS data are saved automatically as a JSON file `[JAR file location]/data/addressbook.json`. Advanced users are welcome to update data directly by editing that data file.

<div markdown="span" class="alert alert-warning"> :exclamation: **Caution:**
If your changes to the data file makes its format invalid, UNOFAS will discard all data when a command is executed with the corrupted file and start with an empty data file at the next run. Hence, it is recommended to take a backup of the file before editing it.
If your changes to the data file makes its format invalid, UNOFAS will discard all data and start with an empty data file at the next run. Hence, it is recommended to take a backup of the file before editing it.
</div>

### Archiving data files `[coming in v2.0]`
Expand Down
14 changes: 11 additions & 3 deletions docs/team/nikele2001.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,20 @@ such as sorting, scheduling and other commands to query information quickly requ

Given below are my contributions to the project.

* **New Feature**: Added `FinancialPlan` field and wrote tests
* Justification: As a financial advisor, it would be convenient to have a person's current financial plans available for business purposes.
* (Pull request [#69](https://github.com/AY2324S1-CS2103T-F12-1/tp/pull/69))

* **New Feature**: Added appointment sidebar that shows upcoming appointments of clients in chronological order and wrote tests
* Justification: Financial advisors may want to view all upcoming appointments easily in chronological order so that it is easier for them to plan their timetables.
* Highlights: This enhancement creates another UI element to show various other appointment-specific details in the future. It requires an understanding of ObservableList interface and the way the list is being tracked by JavaFX.
* (Pull request [#110](https://github.com/AY2324S1-CS2103T-F12-1/tp/pull/110))

* **Code Contributed**: [RepoSense](https://nus-cs2103-ay2324s1.github.io/tp-dashboard/?search=nikele2001&breakdown=true)

* **Enhancements Implemented**:
* Added `FinancialPlan` field and wrote tests
(Pull request [#69](https://github.com/AY2324S1-CS2103T-F12-1/tp/pull/69))
* Added appointment sidebar that shows upcoming appointments of clients in chronological order and wrote tests (Pull request [#110](https://github.com/AY2324S1-CS2103T-F12-1/tp/pull/110))
* `FinancialPlan` field to allow financial advisors to execute commands specific to financial plans subscribed by clients
* Override prompt to ask user for confirmation before overriding an appointment.

* **Contributions to the UG**:
* Added and updated all UI images.
Expand Down
1 change: 1 addition & 0 deletions docs/team/sopa301.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Given below are my contributions to the project.
* Justification: `clear` is a very powerful command that can delete the entirety of a user's work in an instant. To
safeguard against mistakes, we decided to add an extra confirmation requirement to ensure that the user actually wants
to wipe the contact book.
* Highlights: This feature causes the logic flow of the method to change if the clear command is about to be executed, getting a response from the user before deciding whether to continue the execution of the program.
* Pull request [#75](https://github.com/AY2324S1-CS2103T-F12-1/tp/pull/75)
* Added available keywords for `help` command
* Pull request [#67](https://github.com/AY2324S1-CS2103T-F12-1/tp/pull/67)
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/seedu/address/MainApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,23 @@
logger.warning("Data file at " + storage.getAddressBookFilePath() + " could not be loaded."
+ " Will be starting with an empty AddressBook.");
initialData = new AddressBook();
this.saveEmptyAddressBook(initialData);

Check warning on line 91 in src/main/java/seedu/address/MainApp.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/MainApp.java#L91

Added line #L91 was not covered by tests
}

return new ModelManager(initialData, userPrefs);
}

/**
* Wipes corrupted data in addressbook.json when starting the application with corrupted data.
*/
private void saveEmptyAddressBook(ReadOnlyAddressBook initialData) {
try {
storage.saveAddressBook(initialData);
} catch (IOException e) {
logger.warning("Failed to locate filepath.");
}
}

Check warning on line 106 in src/main/java/seedu/address/MainApp.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/MainApp.java#L102-L106

Added lines #L102 - L106 were not covered by tests

private void initLogging(Config config) {
LogsCenter.init(config);
}
Expand Down
Loading